Results 1 to 2 of 2
2002-05-17, 16:42 #1
- Join Date
- Jul 2001
- Washington, District Of Columbia, USA
- Thanked 0 Times in 0 Posts
Updating Form Datasheet Results (2000)
I have a form that asks a user to enter part of a company's name. When the user selects Find, the event closes the original form and opens another form with the results in a datasheet format. However, I'd like to have these two forms combined into one so that information in an unbound field in the form header will show all relevant records in the detail section. Similarly, I'll need to do the same with a combo box. The code I'm using in the original forms is below. I've tried using the combo box wizard, but that just gets me the first record. I seem to recall that this is in one of the various Access books that I have, but can't remember which. Any advice would be appreciated.
Dim mysql As String, mywhere As String, myrecords As String
Dim comp As String, alpha As String, subform As Form, n As Integer
mywhere = "ORGANIZATION.[organization] Like " & Chr$(34) & "*" & Me![ubdOrgLook] & "*" & Chr$(34)
DoCmd.OpenForm "frmSelectOrg", acNormal, , mywhere
DoCmd.Close acForm, "frmOrgSearch"
2002-05-17, 19:08 #2
- Join Date
- Aug 2001
- Frederick, Maryland, USA
- Thanked 2 Times in 2 Posts
Re: Updating Form Datasheet Results (2000)
When the user selects find, I assume a query is run to create the recordset. To get the resultant set on the same form, you could create a listbox whose recordset is tied to the query. You could do the same thing with a combo box. After the user makes a selection in the combo box, launch a query to obtain new data and then base the listbox on the query. Make sure you refresh the form at the end of the code. This approach has worked on many forms I have used. I have even gone one step further where a combo box selections updates the data in list box one. A selection in Listbox one updates the data in multi listbox 2. A report is created on the data selected in multilistbox 2.
(It's been a while!)