I've pretty much self taught myself Access VBA through books and trial and error, so I apologize if this is a stupid question, but here goes...
I have a Main form (frmMain) that contains a subform (subMain).
frmMain: Contains only OrganizationName
subMain: Continuous form that contains OrganizationName, NewField1, NewField2, and NewField3
tblOrgName: The table that contains the organizations and is the recordsource for frmMain
tblMain: the table that contains the details of the organizations and is the recordsource for subMain
All of that works just fine.
The problem I'm running into, however, is that on frmMain, I have a command button to allow the users to search OrganizationName with a partial field. (i.e. searching "city" will bring up every record that contains "city." I have these results populated onto a new form, frmOrgSearch. On frmOrgSearch, I have a command button with the goal being to go to the specific record indicated and populate it onto a new version of frmMain, which I've copied and created as frmMain2. This is where the problems begin. The search results come up properly on frmOrgSearch, but when I click the command button to go to that record, it will bring up the record on frmMain2, but NewField1, 2, and 3 of subMain are not populated and are blank. Additionally, if a record has multiple subMain records, instead of showing all the results in subMain, it shows the results as separate records of frmMain. For example, if I searched for "city" and clicked on the record to go to "New York City Shoe Business," it will show 2 records in frmMain instead of 1 record in frmMain with 2 subMain records.
Additional info that may be useful: the search criteria is found by doing a query on frmMain of "Like "*" & [Enter the value to search for] & "*"
I requery subMain after populating the results, but it still shows up as blank. I've tried using DLookup, but I'm sure I'm calling it wrong. I currently have the following under the command button to navigate to the record after the search:
(I did the message box to test to see if it would find the information properly, and it kind of did. It gives me an error of "The expression you entered as a query parameter produced this error: 'Ralph'"
Ralph is the value of NewField1 in the search example I'm trying to make work.
Can anyone help with this? I'm sure I probably explained it in a confusing manner, so I apologize.
I have a Main form (frmMain) that contains a subform (subMain).
frmMain: Contains only OrganizationName
subMain: Continuous form that contains OrganizationName, NewField1, NewField2, and NewField3
tblOrgName: The table that contains the organizations and is the recordsource for frmMain
tblMain: the table that contains the details of the organizations and is the recordsource for subMain
All of that works just fine.
The problem I'm running into, however, is that on frmMain, I have a command button to allow the users to search OrganizationName with a partial field. (i.e. searching "city" will bring up every record that contains "city." I have these results populated onto a new form, frmOrgSearch. On frmOrgSearch, I have a command button with the goal being to go to the specific record indicated and populate it onto a new version of frmMain, which I've copied and created as frmMain2. This is where the problems begin. The search results come up properly on frmOrgSearch, but when I click the command button to go to that record, it will bring up the record on frmMain2, but NewField1, 2, and 3 of subMain are not populated and are blank. Additionally, if a record has multiple subMain records, instead of showing all the results in subMain, it shows the results as separate records of frmMain. For example, if I searched for "city" and clicked on the record to go to "New York City Shoe Business," it will show 2 records in frmMain instead of 1 record in frmMain with 2 subMain records.
Additional info that may be useful: the search criteria is found by doing a query on frmMain of "Like "*" & [Enter the value to search for] & "*"
I requery subMain after populating the results, but it still shows up as blank. I've tried using DLookup, but I'm sure I'm calling it wrong. I currently have the following under the command button to navigate to the record after the search:
DoCmd.OpenForm "frmMain2"
Forms!frmMain!subMain.Requery
TempLookup1 = DLookup([NewField1], "tblMain", "tblOrgName.OrganizationName = frmMain!subMain!OrganizationName"
Msgbox (TempLookup1)
(I did the message box to test to see if it would find the information properly, and it kind of did. It gives me an error of "The expression you entered as a query parameter produced this error: 'Ralph'"
Ralph is the value of NewField1 in the search example I'm trying to make work.
Can anyone help with this? I'm sure I probably explained it in a confusing manner, so I apologize.