Print current record

pwicr

Registered User.
Local time
Today, 02:23
Joined
Sep 22, 2011
Messages
144
I have a command button to print the current form

Private Sub MERCEDES_Click()
On Error GoTo Err_MERCEDES_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "rptMERCEDES"

stLinkCriteria = "[Serial Number]=" & """& Me![Serial Number]&"""
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

Exit_MERCEDES_Click:
Exit Sub

Err_MERCEDES_Click:
MsgBox Err.Description
Resume Exit_MERCEDES_Click
End Sub

When I click the command button, it gives me one record. YAY!!! BUT, there is no information ON the report. When I open the report from the left menu bar all the information is there.

:confused:

Crystal
 
What is the data type of the [Serial Number] field?
 
Text field. It is alpha numeric
 
Use this and tell me the outcome:
Code:
Private Sub MERCEDES_Click()
On Error GoTo Err_MERCEDES_Click

    Dim stLinkCriteria As String
    
    If Me.Dirty Then Me.Dirty = False
    
    stLinkCriteria = "[Serial Number] = " & Chr(34) & Me![Serial Number] & Chr(34)
    DoCmd.OpenReport "rptMERCEDES", acViewPreview, , stLinkCriteria
    
Exit_MERCEDES_Click:
    Exit Sub
    
Err_MERCEDES_Click:
    MsgBox Err.Description
    Resume Exit_MERCEDES_Click

End Sub
 
Hello again,

I need to do the same for chevrolet


Private Sub CHEVROLET_Click()
On Error GoTo Err_CHEVROLET_Click

Dim stLinkCriteria As String

If Me.Dirty Then Me.Dirty = False

stLinkCriteria = "[Serial Number] = " & Chr(34) & Me![Serial Number] & Chr(34)
DoCmd.OpenReport "rptCHEVROLET", acViewPreview, , stLinkCriteria

Exit_CHEVROLET_Click:
Exit Sub

Err_CHEVROLET_Click:
MsgBox Err.Description
Resume Exit_CHEVROLET_Click

End Sub

Exit Sub


Help!!! :o

Crystal
 
I copied it from Mercedes and changed "MERCEDES" to "CHEVROLET" and I get an error (can't seem to get the error to paste)
 
Your button may be having referencing issues. Recreate it.
 

Users who are viewing this thread

Back
Top Bottom