Combo Box/IF statement

chuckgoss

Registered User.
Local time
Today, 16:02
Joined
Mar 26, 2001
Messages
44
Hi all…

I have an If statement that works intermittently, and I can’t see why.

I have a form that begins with the focus being on a combo box upon load. The user keys in a record number for editing, hits the enter key, and the record appears just fine. There is a ‘next record’ button that they use to increment through the related records on the table until they go outside the range of records they want to work with, where they get a msgbox message saying “there are no more lines for that record”. This works great only if you actually click on the combo box prior it performing the query…even though the curser is already there and flashing. If you simply key in the record number and hit enter (without the click) you’ll get the record alright, increment through just fine, but you’ll never get the message telling you that you have exceeded the range of related records.

Is there something about combo boxes where they do better is they get a click and not just receive focus? I would prefer that the click were not a requirement. I’ve never seen this before … (not hard to imagine).

The code behind the next record button is as follows:

DoCmd.GoToRecord , , acNext
If [RecordNumberSD].Value > [Combo59].Value Then
MsgBox "There are no more lines for that record"
DoCmd.GoToRecord acDataForm, "Edit Class A Saw Records", acPrevious
End If

Chuck
 
Well...

I am not sure again exactly what you are looking for.. One of the things I like to do my VBA on when using combo boxes is on change and always restricting users to the list provided through tables or queries.... Which are usually user driven. You could order by Record ID, move last get the highest ID value and always test it when changing records that it is < then that value... Unless you, like I do always create your own ID instead of using the autonumber crap.... Anyhow hope this may help, if not elaborate and I'll get back to you....

Regards,
Brian K Leslie
 

Users who are viewing this thread

Back
Top Bottom