I have a combo box that I want to display options based on the record source of the form. However, the record source is dynamic rather than static (i.e. it changes while doing certain things). How can I make it so that the combo box requeries itself based of what the record source is at any point in the process.
you can use the requery methode:
combobox.Requery
Related
I'm trying to have my access reports have check boxes that if you check one box in report view that one will be the only one that is checked. Currently if I add a check box in the design view and click it in the report view all of the check boxes in the report will add or remove a check mark, not just that individual box for that one record. I am unsure if there is a line in the property sheet that I am missing or that I'm missing something else completely.
Specify a control source for the checkbox. You need to hold the value for each separate checkbox alone.
A checkbox without a control source (Under Data Tab in Properties) will show the same value for all records of the report record source (This is the same for forms).
For example, if you have a report showing Client Number and Client Name for all your clients, and you need to add a checkbox near each record, then the value for the checkbox should be bound to a control source from the report record source. So in the record source you should have the fields: client number, client name, and checkbox Value.
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?
I have a combobox query that uses parameters from a parent item. When I first load the form the combobox is empty, if I go to design view and return to form view the combobox is populated with the correct items.
While searching for the cause of this I decided to create an extra text field that retrieves the same data from the same parent item. On the first launch that textbox is populated while the combobox remains empty.
My last step was to change the combobox query parameter to refer to the newly created textbox. After that the previously working textbox started out empty as well and became populated after going to design view and back.
My hypothesis - the query tries to retrieve the parameters before the text fields are filled. Keep in mind I have reversed loading order of main-form and sub-form as explained here.
I don't know what to google for any more
You can requery the combo in the current event of the main form like so:
Me.Subform1.Form.MyCombo.Requery
I need your help on MS Access 2007.
I have a big problem with my MS Access Unbound Form.
How can I create a combo box i do not want bound to a table, show a multiple value List?
The Combo is named Sector and want these values to be selected in Multiples 9Which should be possible in Access 2007) from the Drop Down List: Fertilizer, Seeds, Pesticides, Veterinary products, Animal Feed, General.
Which Select Statement or VBA code can I use. I need a solution to handle this please.
Precisely a ListBox control will help you. Since you are using it in MS Access - it makes it much easier with the wizard where you can type the items list. Or if you want to use VBA, then you can load the list using AddItem property of ListBox control in the Form_Load event.
Here is one way of doing what you want:
Open up the table your Form will use. Then: Datasheet view, Datasheet Tab, Lookup Column. Select option: I will type in ... Next Under Col1 enter one of the user choices you want; for example
A Dogs, then under that enter another choice; for example B Cats, etc Next give your lookup column label a name or stay with the default. Finally, Check Allow Multiple Values box. Finish.
You now have a table with a combo box that allows the user to select 0, 1 or many choices.
But you want it on a Form.
Create Tab, Click Form. You now have a Form that has a multi value combobox.
But you want it on a form you already created.
Right click the ComboBox. Copy. Close the table and open the form you want the ComboBox to be a part of.
Right click on a clean part of the form and Paste.
Hope this is what you were looking for.