A step in my macro is to open a form where the record in the new form will
match the value selected on the first form's dropdown box. The IDs,
unfortunately, are text and not numeric, so I'm having trouble finding the
right record in the set.
my "where" is:
[customerID] = [forms]![details]![customerID]
but despite my variations in writing this, I get either a type mismatch, or
a new record comes up (though I can see the filter has been applied).
The dropdown box I'm using to select the customerID on the first form does
not
have a control source, though I'm certain it's bound to the correct value
(the ID)
and not the customer name, which is the only other field displayed.
I'm guessing this is just a problem because the equation thinks i'm looking
for a numeric value, but I'm not sure how to put quotes, or whatever, to
indicated the value is text.
Help?!
Ofer - 25 Jul 2005 23:22 GMT
Try this for string
"[customerID] = '" & [forms]![details]![customerID] & "'"
For Number
"[customerID] = " & [forms]![details]![customerID]
For Date
"[DateField] = #" & [forms]![details]![DateField] & "#"
> A step in my macro is to open a form where the record in the new form will
> match the value selected on the first form's dropdown box. The IDs,
[quoted text clipped - 19 lines]
>
> Help?!
r - 26 Jul 2005 00:01 GMT
Thanks. Unfortunately, the one for string did not work. The "where"
statement is part of the OpenForm "Where" criteria in a macro, if that
helps.
> Try this for string
> "[customerID] = '" & [forms]![details]![customerID] & "'"
[quoted text clipped - 28 lines]
> >
> > Help?!
John Vinson - 26 Jul 2005 00:29 GMT
>A step in my macro is to open a form where the record in the new form will
>match the value selected on the first form's dropdown box. The IDs,
[quoted text clipped - 4 lines]
>
>[customerID] = [forms]![details]![customerID]
Try putting in the syntactically required quotemarks:
Dim strWhere As String
strWhere = "[CustomerID] = '" & Forms!Details!CustomerID & "'"
DoCmd.OpenForm strWhere
John W. Vinson[MVP]