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)
 
Back
Top