Form to open report based on several combo boxes

M

Momof2

I need to open a report based on three conditions. Contractor, Card, and
Statement, which is provided from combo boxes. I am able to to open the
report based on the Contractor combo box, I'm just not sure how to
incorporate the other two and have them all work together. Here is what I am
using to pull from the contractor combo box. How can I add the other two to
make it all work? Any help is greatly appreicated!

Dim StrWhere As String

StrWhere = "[Contractor] = """ & Me.Contractor & """"


DoCmd.OpenReport "coding", acViewPreview, , StrWhere
 
B

Beetle

This assumes that they are all text data types;

StrWhere = "[Contractor] = """ & Me.Contractor & """ And [Card]= """ _
& Me.Card & """ And [Statement]= """ & Me.Statement & """"
 
M

Momof2

I changed it to that now when I go to run it, I get a debug error and the
following comes back highlighted in yellow. Can you help with what is wrong
with this part?

DoCmd.OpenReport "coding", acViewPreview, , StrWhere

Beetle said:
This assumes that they are all text data types;

StrWhere = "[Contractor] = """ & Me.Contractor & """ And [Card]= """ _
& Me.Card & """ And [Statement]= """ & Me.Statement & """"


--
_________

Sean Bailey


Momof2 said:
I need to open a report based on three conditions. Contractor, Card, and
Statement, which is provided from combo boxes. I am able to to open the
report based on the Contractor combo box, I'm just not sure how to
incorporate the other two and have them all work together. Here is what I am
using to pull from the contractor combo box. How can I add the other two to
make it all work? Any help is greatly appreicated!

Dim StrWhere As String

StrWhere = "[Contractor] = """ & Me.Contractor & """"


DoCmd.OpenReport "coding", acViewPreview, , StrWhere
 
B

Beetle

Are [Contractor], [Card] and [Statement] all text data types, and are
they the bound columns in their respective combo boxes?
--
_________

Sean Bailey


Momof2 said:
I changed it to that now when I go to run it, I get a debug error and the
following comes back highlighted in yellow. Can you help with what is wrong
with this part?

DoCmd.OpenReport "coding", acViewPreview, , StrWhere

Beetle said:
This assumes that they are all text data types;

StrWhere = "[Contractor] = """ & Me.Contractor & """ And [Card]= """ _
& Me.Card & """ And [Statement]= """ & Me.Statement & """"


--
_________

Sean Bailey


Momof2 said:
I need to open a report based on three conditions. Contractor, Card, and
Statement, which is provided from combo boxes. I am able to to open the
report based on the Contractor combo box, I'm just not sure how to
incorporate the other two and have them all work together. Here is what I am
using to pull from the contractor combo box. How can I add the other two to
make it all work? Any help is greatly appreicated!

Dim StrWhere As String

StrWhere = "[Contractor] = """ & Me.Contractor & """"


DoCmd.OpenReport "coding", acViewPreview, , StrWhere
 
M

Momof2

yes I believe they are

Beetle said:
Are [Contractor], [Card] and [Statement] all text data types, and are
they the bound columns in their respective combo boxes?
--
_________

Sean Bailey


Momof2 said:
I changed it to that now when I go to run it, I get a debug error and the
following comes back highlighted in yellow. Can you help with what is wrong
with this part?

DoCmd.OpenReport "coding", acViewPreview, , StrWhere

Beetle said:
This assumes that they are all text data types;

StrWhere = "[Contractor] = """ & Me.Contractor & """ And [Card]= """ _
& Me.Card & """ And [Statement]= """ & Me.Statement & """"


--
_________

Sean Bailey


:

I need to open a report based on three conditions. Contractor, Card, and
Statement, which is provided from combo boxes. I am able to to open the
report based on the Contractor combo box, I'm just not sure how to
incorporate the other two and have them all work together. Here is what I am
using to pull from the contractor combo box. How can I add the other two to
make it all work? Any help is greatly appreicated!

Dim StrWhere As String

StrWhere = "[Contractor] = """ & Me.Contractor & """"


DoCmd.OpenReport "coding", acViewPreview, , StrWhere
 

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