OpenForm filter

  • Thread starter Thread starter Emma
  • Start date Start date
E

Emma

Could anyone tell me why this line isn't working?

-----
Dim IDNumTemp As Integer
IDNumTemp = List10.Column(0)

DoCmd.OpenForm "frmclientinformation", acNormal, ,
ClientID = IDNumTemp, acFormEdit
-----

I have a form with a list box with multiple values in
each row. I want to select a row and then have a new form
open with the information about that client. Column(0) is
the clientID.

The new form will open, but it opens blank.

Any help would be so much appreciated. Surely it
shouldn't be this hard! :)
 
The WhereCondition argument of OpenForm must be a string.
Concatenate the value of the integer onto the rest of the string:

DoCmd.OpenForm "frmclientinformation",,,"ClientID = " & IDNumTemp

Without the quote marks, Access will evaluate the expression:
ClientID = IDNumTemp
and decide that the statement is either True or False:
- True if the ClientID field in the current form is the same number,
- False if it a different number.

If True, the form will load with every record, i.e. the WhereCondition is
True for all records. If False, the form will load with no records, i.e. the
WhereCondition is False for all records.
 
A million thank you's!
-----Original Message-----
The WhereCondition argument of OpenForm must be a string.
Concatenate the value of the integer onto the rest of the string:

DoCmd.OpenForm "frmclientinformation",,,"ClientID = " & IDNumTemp

Without the quote marks, Access will evaluate the expression:
ClientID = IDNumTemp
and decide that the statement is either True or False:
- True if the ClientID field in the current form is the same number,
- False if it a different number.

If True, the form will load with every record, i.e. the WhereCondition is
True for all records. If False, the form will load with no records, i.e. the
WhereCondition is False for all records.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top