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.
Related
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?
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.
I'm a newish user to Access and I'm having trouble using a button to view a set of records based on a query with several criteria. I am creating a database to house employee quality assessments. As seen below the subform pulls four records. view of data showing 4 records when I click the circled button it takes me to the expanded view of the record that is selected on the subform. Once I get there however I only have the one record. expanded view of a single record with no other records available on the navigation bar I would like to be able to browse back and forth between all four records rather than closing the form and going back to the summary. Hopefully someone can point me at what I am doing wrong.
Just so it can be marked as answered - Change the record source of the expanded view form to match the calling sub form's record source.
I have a main Purchase_Orders Form with an Items subform. I have also created a button that opens a popup form and queries previous Purchase orders for items that have been purchased from the same supplier which has been selected on the main form. I have added an unbound checkbox to this popup query.
Now what I want to be able to do, is have an "assign" button that will select each record in the query where the checkbox = true (or 1 I'm not sure). And then input those records in to the main subform, Items.
Is this possible? and any ideas how I may go about coding this in VBA? I am pretty new to VBA but if I get anywhere with the code, I will edit this post with further info. Thanks!
If you want to add multiple items at once then you will need to use some form of unbound control, and a VBA loop to insert.
The simplest way would be to load a multi-select enabled ListBox and use that to allow the user to choose items. Then upon clicking the Assign button, you can loop through the listbox and insert the items into the table.
If you want more specific help you're going to need to provide much more specific data. Table structures, form fields/data sources, form names, perhaps some VBA behind the forms.
I have a form that contains 4 subforms. The first subform gets data based on a selection in a combo box on the main form. The second subform gets data based on the first subform, and the third and fourth subforms get data based on the first.
It's a database contain information on research grants. I want to be able to pull up certain data based on a person's ID (multiple records to a person) or by the title of the grant. Names are working fine, but searching by title is giving me a hard time.
I've tried setting first subform's Record Source with a .RecordSource ="" line, but nothing updates at all when the code runs (the code is in the AfterUpdate event of the combo box containing grant titles). This one has me sort of stuck; I'm not sure if the dependencies among my forms have something to do with it.
Did you put a Form.Refresh in after you updated the recordsource?