Question on Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

DoCmd.OpenReport "DIA",acViewPreview , , "[Country]='" & Me![Combo59] & "'"


If my Country was changed to ID Number which is a number where do i take out
quotes, and what will the code look like
 
You only need quotes (single or double double) when you
are filtering a text field. eg Country.

DoCmd.OpenReport "DIA",acViewPreview , , "[Country]=""" &
Me![Combo59] & """"

ID Answer
DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" & Me!
[Combo59]

The other thing, it's always best to rename your controls
from the default to make programming life easier. eg.
Combo59 to cboCountry. Also use dot notation to catch any
errors at design time eg.

DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" &
Me.cboCountry
 
Here is my code and it doesnt appear to work:

DoCmd.OpenReport "JPMC", acViewPreview, , [UserOrgId]= & Me![Combo14] & "'"

What could be wrong


Cheval said:
You only need quotes (single or double double) when you
are filtering a text field. eg Country.

DoCmd.OpenReport "DIA",acViewPreview , , "[Country]=""" &
Me![Combo59] & """"

ID Answer
DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" & Me!
[Combo59]

The other thing, it's always best to rename your controls
from the default to make programming life easier. eg.
Combo59 to cboCountry. Also use dot notation to catch any
errors at design time eg.

DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" &
Me.cboCountry
-----Original Message-----
DoCmd.OpenReport "DIA",acViewPreview , , "[Country]='" & Me![Combo59] & "'"


If my Country was changed to ID Number which is a number where do i take out
quotes, and what will the code look like
.
 
Pam, assuming UserOrgID is a number change it to
DoCmd.OpenReport "JPMC", acViewPreview, , "[UserOrgId]=" & Me![Combo14]

Hope this helps!

Reggie

Here is my code and it doesnt appear to work:

DoCmd.OpenReport "JPMC", acViewPreview, , [UserOrgId]= & Me![Combo14] & "'"

What could be wrong


:

You only need quotes (single or double double) when you
are filtering a text field. eg Country.

DoCmd.OpenReport "DIA",acViewPreview , , "[Country]=""" &
Me![Combo59] & """"

ID Answer
DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" & Me!
[Combo59]

The other thing, it's always best to rename your controls
from the default to make programming life easier. eg.
Combo59 to cboCountry. Also use dot notation to catch any
errors at design time eg.

DoCmd.OpenReport "DIA",acViewPreview , , "CountryID=" &
Me.cboCountry

-----Original Message-----
DoCmd.OpenReport "DIA",acViewPreview , , "[Country]='" &

Me![Combo59] & "'"
If my Country was changed to ID Number which is a number

where do i take out
quotes, and what will the code look like
.
 
Back
Top