
Am I stupid or is it VB? [Recordsets]
Here goes, hope this makes sense:
The user may search using two criteria, AONum & JobNum. JobNum is
fine (because this is the primary key and there can only possibly be
one). Anyway, when searching by AONum this may find more than one
JobNum with that same AONum, so the user can then select which job
from a datagrid, this works fine all the time there are > 0 records
found. However, the program crashes if the JobNum is not found
because I have had to use this statement:
Data1.Recordset.MoveFirst
Data1.Recordset.MoveLast
If Data1.Recordset.RecordCount > 0 Then
Because without moving first and then last the recordcount always
comes back as 0, this is an annoying bug. As you can see this will
work fine if the recordsets are actually > 0, but if the recordsets
are = 0 obviously it is not possible to move first then last, and this
crashes the program. I tried using:
If rsJobs.AbsolutePosition > 0 Then
But it was proving even more difficult. I hope someone can help, any
ideas are appreciated.
Thanks,
Lee.