bug in where condition

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

Guest

i'm using a2k to put a cmd button on a form called "Ad Hoc PRMS Review" to
print a report (having the same name as the form) subject to the condition
that a control on the form called "PRC_Number" (which can actually hold
textual information) equals the value called "PRMC_Number" which is the
control source for "PRC_Number". what happened when i ran it is that i got a
report minus any data in the controls. basically, i wrote a 'report' to print
what the user has input into the 'entry screen' (access 'form') for archival
purposes and out popped a report having all the labels and textual controls i
designed but none of the non-label controls had any data in 'em. anybody have
a feeling for what's going on there?

-ted
 
i guess i should've added the code behind the cmd button


Private Sub Report_Click()
On Error GoTo Err_Report_Click

Dim stDocName As String

stDocName = "Ad Hoc PRMS Review"
DoCmd.OpenReport stDocName, acNormal, , "PRMC_Number = "" & Forms![Ad
Hoc PRMS Review]!PRC_Number"

Exit_Report_Click:
Exit Sub

Err_Report_Click:
MsgBox Err.description
Resume Exit_Report_Click

End Sub
 
If PRMC_Number is a text field, then

Private Sub Report_Click()
On Error GoTo Err_Report_Click

Dim stDocName As String
Dim stCriteria as String

stDocName = "Ad Hoc PRMS Review"
stCriteria = "PRMC_Number = """ & Forms![Ad Hoc PRMS Review]!PRC_Number
& """"

DoCmd.OpenReport stDocName, acNormal, ,stCriteria

Exit_Report_Click:
Exit Sub

Err_Report_Click:
MsgBox Err.description
Resume Exit_Report_Click

End Sub

If PRMC_Number is a number field then drop the extra quotes.
stCriteria = "PRMC_Number = " & Forms![Ad Hoc PRMS Review]!PRC_Number


Ted said:
i guess i should've added the code behind the cmd button


Private Sub Report_Click()
On Error GoTo Err_Report_Click

Dim stDocName As String

stDocName = "Ad Hoc PRMS Review"
DoCmd.OpenReport stDocName, acNormal, , "PRMC_Number = "" & Forms![Ad
Hoc PRMS Review]!PRC_Number"

Exit_Report_Click:
Exit Sub

Err_Report_Click:
MsgBox Err.description
Resume Exit_Report_Click

End Sub

Ted said:
i'm using a2k to put a cmd button on a form called "Ad Hoc PRMS Review"
to
print a report (having the same name as the form) subject to the
condition
that a control on the form called "PRC_Number" (which can actually hold
textual information) equals the value called "PRMC_Number" which is the
control source for "PRC_Number". what happened when i ran it is that i
got a
report minus any data in the controls. basically, i wrote a 'report' to
print
what the user has input into the 'entry screen' (access 'form') for
archival
purposes and out popped a report having all the labels and textual
controls i
designed but none of the non-label controls had any data in 'em. anybody
have
a feeling for what's going on there?

-ted
 
right you are, john. works like a charm. where'd guys like this newbie be w/o
y'all!!

do i = 1 to 1000
print 'thanks'
end


John Spencer said:
If PRMC_Number is a text field, then

Private Sub Report_Click()
On Error GoTo Err_Report_Click

Dim stDocName As String
Dim stCriteria as String

stDocName = "Ad Hoc PRMS Review"
stCriteria = "PRMC_Number = """ & Forms![Ad Hoc PRMS Review]!PRC_Number
& """"

DoCmd.OpenReport stDocName, acNormal, ,stCriteria

Exit_Report_Click:
Exit Sub

Err_Report_Click:
MsgBox Err.description
Resume Exit_Report_Click

End Sub

If PRMC_Number is a number field then drop the extra quotes.
stCriteria = "PRMC_Number = " & Forms![Ad Hoc PRMS Review]!PRC_Number


Ted said:
i guess i should've added the code behind the cmd button


Private Sub Report_Click()
On Error GoTo Err_Report_Click

Dim stDocName As String

stDocName = "Ad Hoc PRMS Review"
DoCmd.OpenReport stDocName, acNormal, , "PRMC_Number = "" & Forms![Ad
Hoc PRMS Review]!PRC_Number"

Exit_Report_Click:
Exit Sub

Err_Report_Click:
MsgBox Err.description
Resume Exit_Report_Click

End Sub

Ted said:
i'm using a2k to put a cmd button on a form called "Ad Hoc PRMS Review"
to
print a report (having the same name as the form) subject to the
condition
that a control on the form called "PRC_Number" (which can actually hold
textual information) equals the value called "PRMC_Number" which is the
control source for "PRC_Number". what happened when i ran it is that i
got a
report minus any data in the controls. basically, i wrote a 'report' to
print
what the user has input into the 'entry screen' (access 'form') for
archival
purposes and out popped a report having all the labels and textual
controls i
designed but none of the non-label controls had any data in 'em. anybody
have
a feeling for what's going on there?

-ted
 
Back
Top