Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct syntax for an integer value

Status
Not open for further replies.

nflutter

Technical User
Aug 7, 2005
34
GB
I'm trying to pass a string to print the current record on an access form, keep getting a syntax error, just cant work it out.

Dim strWhere As String
strWhere = "Contact ID=" & Me.ContactID

I think there should be single quotes around the Me.ContactID value but cant get them right! any help appreciated.

Thanks
 
If Contact ID is a field name with a space in it (never a good practice and the field is text, try:
Code:
Dim strWhere As String
strWhere = "[Contact ID]=""" & Me.ContactID & """"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top