Changing field type breaks my report

bigalpha

Registered User.
Local time
Today, 11:57
Joined
Jun 22, 2012
Messages
415
I have a search form that has a button so i can open a report by using PWO_Number from the selected entry in the search form.

That field is a Number field.
When I changed it to a Text field, it no longer opens a report based on the PWO_Number; it asks for a paramater value.

Not sure if I have to change something in the code since I went from Number to Text?

Here's my code:
PHP:
Private Sub Command60_Click()
On Error GoTo Err_Command60_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "rpt_MultiSearch_PWO Report"
    
    stLinkCriteria = "[PWO_Number]=" & Me![SearchResults]
    DoCmd.OpenReport stDocName, acViewReport, , stLinkCriteria
Exit_Command60_Click:
    Exit Sub
Err_Command60_Click:
    MsgBox Err.Description
    Resume Exit_Command60_Click
    
End Sub
 
Code:
[SIZE=3][FONT=Arial]Private Sub Command60_Click()[/FONT][/SIZE]
[SIZE=3][FONT=Arial]DoCmd.OpenReport “rpt_MultiSearch_PWO Report” , , , “PWO_Number = ‘” & Me.SearchResults & “’”[/FONT][/SIZE]
[SIZE=3][FONT=Arial]End Sub[/FONT][/SIZE]
 
Ah yes! I thought I remember something about the criteria being different between the two fields. I couldn't find that page again, though.

Thanks, that solved my problem!
 

Users who are viewing this thread

Back
Top Bottom