How to choose the right event ?

E

Ed Dror

Hi there,

I have a barcode (2D) which transfer the information to my form.
The last recod in the form is like 005} and it stay there (textbox)
And I want to move to a new record so I wrote

Private Sub Suffix_Dirty(Cancel As Integer)
On Error GoTo Err_CmdNew_Click

DoCmd.GoToRecord , , acNewRec
Me.Description.SetFocus
Exit_CmdNew_Click:
Exit Sub

Err_CmdNew_Click:
MsgBox Err.Description
Resume Exit_CmdNew_Click
End Sub

Even AfterUpdate or GotFocus it dosen't save the record it move it into the
next textbox

(I know you can press TAB but i don't want the user do extra typing)

How do I make sure that the last textbox get the value and then move to new
record?

Thanks,
Ed Dror
 
D

Douglas J. Steele

What is Suffix, the name of the control?

Text boxes don't have a Dirty event, only the Form does. Try changing it to

Private Sub Form_Dirty(Cancel As Integer)

and see whether it works. (and just in case Suffix is the name of your form,
it's the word Form that must be there, not the name!)
 
J

John W. Vinson

How do I make sure that the last textbox get the value and then move to new
record?

Several steps needed:

- The field to which the textbox is bound must be a Text field and it must be
the same size for each record. If the field is of variable length, Access has
no way to know that you're "done" with the field!
- Set the control's AutoTab property to Yes (thus if the field is 8 bytes
long, it will tab the instant the eighth character is entered either by typing
or from the scanner).
- Set the form's Cycle property to All Records.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top