laoding name from combo box to report

  • Thread starter jln via AccessMonster.com
  • Start date
J

jln via AccessMonster.com

Ok here is what im trying to do is

Dim strwhere as string
Dim stDocName as string


If Not IsNull(Me.combo27) Then
strWhere = strWhere & "[Assigned To]=" & Me.Me.combo27
End If

DoCmd.OpenReport stDocName, acprint, , strWhere

Im getting a syntax error could someone help me out.
 
D

Douglas J. Steele

Is Assigned To a text field? If so, you need quotes around the value:

If Not IsNull(Me.combo27) Then
strWhere = strWhere & "[Assigned To]='" & Me.Me.combo27 & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & "[Assigned To]= ' " & Me.Me.combo27 & " ' "

If it's a name that could contain an apostrophe (O'Reilly), use:

strWhere = strWhere & "[Assigned To]= " & Chr$(34) & Me.Me.combo27 &
Chr$(34)
 
J

jln via AccessMonster.com

Douglas

Thanks that was just what i needed
Is Assigned To a text field? If so, you need quotes around the value:

If Not IsNull(Me.combo27) Then
strWhere = strWhere & "[Assigned To]='" & Me.Me.combo27 & "'"
End If

Exagerated for clarity, that's

strWhere = strWhere & "[Assigned To]= ' " & Me.Me.combo27 & " ' "

If it's a name that could contain an apostrophe (O'Reilly), use:

strWhere = strWhere & "[Assigned To]= " & Chr$(34) & Me.Me.combo27 &
Chr$(34)
Ok here is what im trying to do is
[quoted text clipped - 8 lines]
Im getting a syntax error could someone help me out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top