Opening Report based on Form

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

Guest

I am trying to open a report based on 2 criteria on the form and my button
code look like this:

Dim strWhere As String
strWhere = "[lngProgEnrolNo]=" & Me.lngProgEnrolNo And
"[lngProgCurrlmNo] =" & Me.cboProgram
DoCmd.OpenReport "rptRecofCourses", acPreview, , strWhere

I keep getting a type mismatch error. Is this the right way of doing it?
Thanks.
ck
 
CK said:
I am trying to open a report based on 2 criteria on the form and my
button code look like this:

Dim strWhere As String
strWhere = "[lngProgEnrolNo]=" & Me.lngProgEnrolNo And
"[lngProgCurrlmNo] =" & Me.cboProgram
DoCmd.OpenReport "rptRecofCourses", acPreview, , strWhere

I keep getting a type mismatch error. Is this the right way of doing
it?

It would be, but you've made an error in building your strWhere
variable. Try this:

strWhere = "[lngProgEnrolNo]=" & Me.lngProgEnrolNo & _
" And [lngProgCurrlmNo] =" & Me.cboProgram
 
Thanks, Dirk.
ck

Dirk Goldgar said:
CK said:
I am trying to open a report based on 2 criteria on the form and my
button code look like this:

Dim strWhere As String
strWhere = "[lngProgEnrolNo]=" & Me.lngProgEnrolNo And
"[lngProgCurrlmNo] =" & Me.cboProgram
DoCmd.OpenReport "rptRecofCourses", acPreview, , strWhere

I keep getting a type mismatch error. Is this the right way of doing
it?

It would be, but you've made an error in building your strWhere
variable. Try this:

strWhere = "[lngProgEnrolNo]=" & Me.lngProgEnrolNo & _
" And [lngProgCurrlmNo] =" & Me.cboProgram

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Back
Top