Nimber of Records

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

The following code in the OnCurrent of my form doesn' display 0 Items as I
wish
when the form returns no records.

If IsNull(Me!ProductID) Then

Me.txtCount = Me.RecordsetClone.RecordCount & "0 Item(s)"

Else
Me.RecordsetClone.MoveLast
Me.txtCount = Me.RecordsetClone.RecordCount & " Item(s)"
End If

Any ideas,
James
 
Try:

Me.RecordsetClone.MoveLast
Me.txtCount = Me.RecordsetClone.RecordCount & " Item(s)"

Sam
 
I put that into the part after If IsNull...
I'm even unable to generate a message box if it returns no records.
This is a split form in access 2007.
 
Hi again, JamesJ.

Just a thought and question: Is it possible that you have a blank record in
your table?

The only reason that I ask is that, again, your code works as expected here
for me.

The only reason that I can think of that would cause your code to not
execute the code that is expected to run when the ProductId is null is that
the table is not empty of records. Just for grins why don't you create a new
table with an autonumber field and one other text field. Then just have
Access to create the spilit form and test your code in the new form to see if
you get it to work.
 
Hi again, JamesJ.

Just a thought and question: Is it possible that you have a blank record in
your table?

The only reason that I ask is that, again, your code works as expected here
for me.

The only reason that I can think of that would cause your code to not
execute the code that is expected to run when the ProductId is null is that
the table is not empty of records. Just for grins why don't you create a new
table with an autonumber field and one other text field. Then just have
Access to create the spilit form and test your code in the new form to see if
you get it to work.
 
James, how about:

If IsNull(Me.ProductID) Then
Me.txtCount="0 Item(s)"
Else
same code you have now
End IF
 
ProductID is an Autonumber field.
Even if I had a blank record it should show 1 item.
I even set the Autonumber field to Visible and it showed
no value.
I'm filtering the records using a combo box populated by a lookup table.
One of the the selections I know has no records.

James
 
I think That' swhat I tried first so I figured I through the RecordsetClone
in.
I'm filtering the records using a combo box populated by a lookup table.
One of the the selections in the cbo I know has no records.

James
 
Back
Top