I need to search within a table, defined as rec1, for records that match both criteria:
field [Zip] = input zip code
field [Zip4] = input zip+4 code.
Current code as typed into the form is:
Which returns records in which the Zip4 equals Zip4Name, but the Zip has nothing at all to do with the entered ZipName.
I tried to use an ampersand (&):
Which returns a syntax error. The help files are not helpful in figuring out the correct syntax. Just for argument's sake, I tried using "AND:
But that also yields a syntax error.
My questions:
1. Is it possible to use multiple arguments in a FindFirst command? If so, how?
2. If not, the only other solution I see is to create a temporary table, rec2, to pass all records that fit the first criterion to, then use rec2.FindFirst to search within that. But that seems rather unnecessarily code-intensive. Are there any other options here?
Thanks!
-Shawn
field [Zip] = input zip code
field [Zip4] = input zip+4 code.
Current code as typed into the form is:
Code:
rec1.FindFirst "Zip =" & [Forms]![form1]![ZipName]
rec1.FindFirst "Zip4 =" & [Forms]![form1]![Zip4Name]
Which returns records in which the Zip4 equals Zip4Name, but the Zip has nothing at all to do with the entered ZipName.
I tried to use an ampersand (&):
Code:
rec1.FindFirst "Zip =" & [Forms]![form1]![ZipName]& "Zip4 =" & [Forms]![form1]![Zip4Name]
Which returns a syntax error. The help files are not helpful in figuring out the correct syntax. Just for argument's sake, I tried using "AND:
Code:
rec1.FindFirst "Zip =" & [Forms]![form1]![ZipName] AND "Zip4 =" & [Forms]![form1]![Zip4Name]
But that also yields a syntax error.
My questions:
1. Is it possible to use multiple arguments in a FindFirst command? If so, how?
2. If not, the only other solution I see is to create a temporary table, rec2, to pass all records that fit the first criterion to, then use rec2.FindFirst to search within that. But that seems rather unnecessarily code-intensive. Are there any other options here?
Thanks!
-Shawn