Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a button

Status
Not open for further replies.

irethedo

Technical User
Feb 8, 2005
429
US
Is it possible to set a button if the focus is currently set to it and if so, how can this be done?

I have a form that I am populating with a bar code scanner but I have two seperate varieties of scanner; one that inserts a CRLF at the end of a scan and one that does not- (these are programmed this way for other applications that they use.)

On my form, an "Add record" push button is the last in the tab order and I would like the record to be automatically saved and the field cleared when either version of bar code scanner populates the fields on the form.

One other related question is how do I make sure that the user doesn't bump the keyboard and set the focus to the wrong starting field before a scan is performed resulting in a messed up record?


Thanks in advance
 
How are ya irethedo . . .

. . . and this:
Code:
[blue]   Me!ControlName = Replace(Me!ControlName, vbNewLine, "")
   DoCmd.RunCommand acCmdSaveRecord
   Me!ControlName = ""[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks AceMan1-

Do I add this code to the "Add Record" button's events?

Please advise
 
irethedo . . .

Sorry to get back so late.

Yes . . . code goes in the button . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top