J
JHB
I posted this message earlier--but somehow it did not make it to the
Group
I have a form which is intended to display a list of records when more
than one results from a selection. It is executing the following code
on Open. The code is intended to call a macro when ONLY one record is
in the selected table. When more than one record (and less than 100)
are found it is supposed to drop through the macro and show the form
it is associated with. The form gets its data from a Temporary table
of records. The issue I have it that the code appears to work when
more than 100 records are in the table and when there are NO records
BUT IT ALWAYS EXECUTED THE MACRO WHEN THERE ARE NOT 100 OR 0 RECORDS.
In other words when the record count is 2 it does NOT drop through the
code.
Could someone either (a) show me how to display the record count that
his code is working (which may be the problem)with OR tell me what on
earth could be happening!
Thanks in advance
John Baker
Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount > 100 Then
MsgBox "You have more that 100 items selected. Try again", vbOKOnly
Cancel = True
End If
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "No Locations found with these keys", vbOKOnly
Cancel = True
End If
If Me.RecordsetClone.RecordCount = 1 Then
DoCmd.RunMacro "Locations2update"
End If
End Sub
Group
I have a form which is intended to display a list of records when more
than one results from a selection. It is executing the following code
on Open. The code is intended to call a macro when ONLY one record is
in the selected table. When more than one record (and less than 100)
are found it is supposed to drop through the macro and show the form
it is associated with. The form gets its data from a Temporary table
of records. The issue I have it that the code appears to work when
more than 100 records are in the table and when there are NO records
BUT IT ALWAYS EXECUTED THE MACRO WHEN THERE ARE NOT 100 OR 0 RECORDS.
In other words when the record count is 2 it does NOT drop through the
code.
Could someone either (a) show me how to display the record count that
his code is working (which may be the problem)with OR tell me what on
earth could be happening!
Thanks in advance
John Baker
Private Sub Form_Open(Cancel As Integer)
If Me.RecordsetClone.RecordCount > 100 Then
MsgBox "You have more that 100 items selected. Try again", vbOKOnly
Cancel = True
End If
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "No Locations found with these keys", vbOKOnly
Cancel = True
End If
If Me.RecordsetClone.RecordCount = 1 Then
DoCmd.RunMacro "Locations2update"
End If
End Sub