Access 2016 drop-down list appearing in Reports and Queries - ms-access

In Access 2016 I have a table called 'Orders'.
I also have a Form (also called 'Orders') that we use to enter order information. On the form, one field in particular ('Company') is a drop-down list. The control source is a second table called 'Companies'. And the Row Source is a SQL Query:
SELECT [Companies].[ID], [Companies].[CompanyName] FROM Companies ORDER BY [CompanyName];
So, when the user is entering an order into the Form, he/she can select the company name from this drop-down list and it in turn updates the Orders table. All basic stuff, and it works fine.
Next, I created a query (also called 'Orders') and it is based off of the Orders table.
When I run the query in Access and view it as a Datasheet, I was surprised to notice that the Company field (IN THE QUERY datasheet) is a drop-down list. Not only that, it even lets me change the value - right here in the query! If I view the SQL for this query, I can see that it is a SELECT query. In my mind, a SELECT query is read only. So my questions are - What's a drop-down list doing in a Query, and WHY does Access let me edit the values directly in the query? Isn't this supposed to be read only?
Next question:
After verifying that all of the data I need is in the Orders query, I then created a report (called 'All Orders') and the control source for this report is the Orders query. (not the table).
When I view the Report in Design view, there's the drop-down list again. Why? I am just looking to add the Company name that the user selected when they completed the form. I realize that the form Control for entering that data (on the FORM) is a drop-down list. But here I am building a report and I just want the VALUE to appear here. Not the drop down control? (I know that when I print the report or view it on the screen, the drop-down boxes go away and all I see is the actual text). But my question is - WHY is Access showing me a drop-down list control on a report? and in a select query? The query and the report are no place for editing data. I just want the value that was selected.

That's because you've defined the lookup list in the table. If you do so, it propagates to queries and new reports and forms, and will be the default way to view the data everywhere you've placed it.
Open your table in design view, and change the display control for your field back to text box. Note that any forms and reports will need to be edited or recreated, for queries the change should propagate.

Related

Access query combo box source based on individual record

my database has MachineT, ProductT and ProductionT.
each product can be made only in some specific machines (multivalue field).
when planning production I need the dropdown menu to show only the possible machines for that product in a form containing a datasheet view.
In the actual database the ProductionF has a data picker and the subform is based on ProductionQ only for that day and it is important to keep the datasheet view because the planner is adding dozens of records in one sitting.
thank you
*edit - I tried to force the field in ProductionT via lookup but it does not filter for each record.
[If you only have 4 machines], what if in ProductT, rather than just one Machine ID, you have fields M1,M2,M3,M4 as a Yes/No (checkbox) selection, then you can make your combo box where fields = True
or maybe this link can help you http://allenbrowne.com/func-concat.html
Edit
What if you have a new table called something like "Product_machine_combo" and this is where you can combine the relationship between the product and the machine used. You could use a list box that lists the Products and have a ListBox for the machines (kind of shown below; link to this resource: https://www.iaccessworld.com/add-items-textbox-listbox/). I just don't know how it would show up in the table. Or you could add a list box to the product form itself?

How to get combo box selection to fill related fields with data

I have a table [inventory] with inventory items, and a bunch of columns with different information for those. Mainly, part#, description, price. I am trying to create both a purchase order form [POForm] and, and a inventory transactions form [TransactionsForm], but that one thing I've been stuck on is getting a combo box look up I use to select the part# from [inventory], to also fill my fields for description, and price for that item in my form. I need the fields that are filled to be able to have formula's run off of them, and the information to be saved into the table for that form [TransactionsTable], [POTable].
I've tried making my part# combo box include the fields for the description and price, and using =[part#].[column](x) in the other fields as a lookup, and it looks right visually, but that is apparently just a visual of that data, but technically the field is still blank, because those other fields remain empty in the table for that form, and I am not able to run a formula off the price.
As per my understanding and please correct me if I am wrong. you have a form that shows your inventory data Part# Description & price. This form has a combo box that allows you to select a particular part # to view its related record data description and price.
Now you want to click a command button after selecting a particular part # to update your transaction form and POtable.
1.you have to create a query,
2.insert the inventory table in it
3.select append from the query type in the ms access ribbon
4.a window will appear, choose the transaction table as the destination table to append to.
5.double click on the fields that you want to retrieve its data from the inventory table
6.then in the table below in the query itself in the "append to" row you will find drop-down menu including all the fields from the transaction table. choose the corresponding fields. note if the fields have the same name in both tables access will do it automatically.
7.in the criteria row type the following [Forms]![Inventory Form Name]![the name of the field in the form]. do that for each field in the happen query.
8.save the query and name it
9.go-to design view in your inventory form and create a command button, in the click on event creat macro of the following: openquery-->type the append query name
10.save and close macro builder
11.open your form, select part#, click on the button
12.access will ask you to confirm appending process. click ok/yes
13.check your transaction table to confirm that the append process was successfully performed
14.Tip if you do not want the confirmation msg of append to appear, in the click on event go to the macro builder and choose in the ribbon show all actions then in the first line of the macro builder insert setwarnings - NO
the same is to be applied for the POtable.
Anyways, I hope you find this clear and helpful but I have only one concern you do not have to append part description and price in transaction and PO tables as you already have this data in your database in the inventory table. Generally speaking no need to include the same information in multiple tables otherwise you are not benefitting from the idea of a relational database.
I hope I addressed your inquiry.

Access - preview what an update query will change

I am using Access to update values within a sharepoint list.
I have the sharepoint list linked as a table, and an excel file with the changes also linked in. These are linked by Purchase Order Number.
I can do an update query and it will update the appropriate values into the sharepoint list. However I would like to "Preview" my changes before I commit them.
What I would like to do is:
Show the purchase order number (key that is common to both lists)
Show the value currently in the sharepoint list
Show what it will be updated to
Then finally tell it to go ahead and make the change
I know this is a basic question but searching doesn't seem to come up with anything similar.
Simply use a select query with the SAME criteria and send the results to a continues form with a “update” or “cancel” button. If the user hits ok, then you run your update/insert query as opposed to the select query that is displaying the data in your current form (or even report).

How make appears a field from the field list automatically?

I just started to use Access with vba. I have table with roles, years and its workload of each role in this specific year. Each record in the table is IDRole, IDYear,Workload (number).
I display the table in a form doing a crosstab table where the years are in the columns and the roles in the rows. The number of years can increase.
My problem is when I add new years and display in the columns, it doesn't appear in the form so I have to select from the field list manually but I would like to know if there is any way in VBA that when the form is load, automatically appears the new columns (years).
I misunderstood your situation. Your form's crosstab data source is actually a table instead of a query. And as you add columns to that table, you want the new columns to automatically appear in the form when you next open the form.
In that case, use the approach described below, but where I selected a query (Query.qryFoo2) in the Source Object dropdown, choose your table ... Table.YourTableName ... in that dropdown.
The last 2 paragraphs below apply whether your data source is a table or query.
If you have your crosstab query saved as a named query, you can use it as the Source Object for a subform control.
Then when you switch from Design to Form View, the query results will be displayed in Datasheet View within the subform control.
As the number of columns changes over time, that Datasheet View can "automagically adapt" to display them ... the same as if you opened the named query directly in Datasheet View.
As far as I'm aware, there is no other reasonably simple way to accomplish what you want. If this suggestion is not suitable, you can explore programmatically adding bound data controls to your existing form after examining the set of fields the query currently returns. But that is way too much effort IMO.
I have exactly the same issue, I have a form which I use to show a Query, And I can't anticipate the number of columns from the query.
I found the same topic on other pages, and for the moment the only way I found is to build an excel file based on the query.
Another way also is maybe to directly open the crossTab query using vba.

Selecting a record in Access Subform

I have a form in Access 2003 that contains 2 subforms. The first is in datasheet view and is only 2 fields, SiteID and SiteName, so a list of many sites for one record in the parent form. The second subform is the same datasource as the first, but in single form view, so it shows all the site fields for one site in a single form. The idea being that I have a list of the site names on the left and I want to then click on one and have its OnCurrent event filter the subform on the right to show all the fields in that record (for that site).
This seems like a fairly simple thing to do but I can't figure out what code (docmd.gotorecord?, filter?, programatically change the subforms query and then requery etc) is the best to use... and how to make it actually work.
Any help appreciated.
Have a look at the Customer Orders form in the Northwind sample database (NWind.mdb) that ships with every version of Access or can be downloaded http://www.microsoft.com/downloads/details.aspx?familyid=c6661372-8dbe-422b-8676-c632d66c529c&displaylang=en
I think you will find it does what you want.