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
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