U
uroron via AccessMonster.com
I have a form with a command button that brings up a report.
The form has no unique identifier since together, the name and the date of
encounter, determine uniqueness. ie. the same person may be entered on 2
different dates and vice - versa.
I am using the following code kindly given me by Allen Browne.
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ssn] = """ & Me.[ssn] & """"
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub
The Problem: When the form comes up, the record that I am looking at in the
form, is displayed only if it contains the smaller of the ssn numbers. If I
am viewing a higher ssn at the time, the record containing the lowest ssn is
displayed on the report not the one I am looking at.
Please help.
Thank you in advance.
Ron
The form has no unique identifier since together, the name and the date of
encounter, determine uniqueness. ie. the same person may be entered on 2
different dates and vice - versa.
I am using the following code kindly given me by Allen Browne.
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ssn] = """ & Me.[ssn] & """"
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub
The Problem: When the form comes up, the record that I am looking at in the
form, is displayed only if it contains the smaller of the ssn numbers. If I
am viewing a higher ssn at the time, the record containing the lowest ssn is
displayed on the report not the one I am looking at.
Please help.
Thank you in advance.
Ron