Tom - this is really great stuff for me, and keep this handy! Thanks for y our help! Clay
--- In AccessDevelopers@yahoogroups.com, "Tom Oakes" <[EMAIL PROTECTED]> wrote: > > I've configured our scanners to always send an {F9} before sending the > contents of the barcode, and an {Enter} afterwards. The application has a > AutoKeys macro (yes) that fires a routine that makes sure the cursor is > where it needs to be. I follow the contents with an {Enter} keystroke, > which effectively fires the AfterUpdate on the textbox. > > The textbox is unbound, and it's AfterUpdate event does all of the > processing (validates the data, puts it where it needs it, moves the focus, > etc). > > The AutoKeys macro {F9} fires this proc: > > '***** code start *****' > Public Function PrepScan() > > '-- moves focus to scan textbox if necessary -- > '-- called as part of scan instructions (via sendkeys) -- > > If IsLoaded("frmScan") Then > With Forms!frmScan!txtBatchID > .SetFocus > .VALUE = Null > End With > End If > > End Function > '***** code end *****' > > The AfterUpdate event on the txtBatchID control can (reasonably) expect the > contents of the barcode to be in that control. You can use the AfterUpdate > event to do whatever you need. If you're adding a record for every scan, > I'd be inclined to do the add programmatically as opposed to trying to move > focus around on a subform, which is error-prone and clumsy. > > So, maybe something like this: > > '***** code start *****' > Sub txtBatchID_AfterUpdate() > > If Not IsNull(Me.txtBatchID) Then > CurrentDb.Execute "INSERT INTO tblSomeTable (SomeField) VALUES (" & > Me.txtBatchID & ")", dbFailOnError + dbSeeChanges > Me.SomeSubform.Form.Requery > End If > > End Sub > '***** code end *****' > > > The barcode stuff I've worked is some of my favorite programming - it's > really amazing how much work can be eliminated by utilizing barcodes & > scanners. > > Tom Oakes > Personal PC Consultants, Inc. > [EMAIL PROTECTED] > 503.230.0911 (O) > 402.968.6946 (C) > 734.264.0911 (F) > > > > > _____ > > From: AccessDevelopers@yahoogroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of brazilianbound > Sent: Friday, December 02, 2005 1:18 PM > To: AccessDevelopers@yahoogroups.com > Subject: [AccessDevelopers] Adding a new record on a event control > > > Hey All! > > What i'm trying to do is when i scan my last barcode, i want it to go > and create a new record. So i'm trying to do this on the After_Update > event on the last control, but apparently i'm not getting it right. > > Do anyone now what the proper syntax is? > > Thanks as always > > Clayton > > > > > > > Please zip all files prior to uploading to Files section. > > > > > SPONSORED LINKS > Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+developer&w1=Microsoft > +access+developer&w2=Microsoft+access+help&w3=Microsoft+access+databa se&w4=M > icrosoft+access+training&w5=Microsoft+access+training+course&w6=Micro soft+ac > cess+programming&c=6&s=193&.sig=d-CjBIrYOH9NCKHYFeGZJA> access developer > Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+help&w1=Microsoft+acce > ss+developer&w2=Microsoft+access+help&w3=Microsoft+access+database&w4 =Micros > oft+access+training&w5=Microsoft+access+training+course&w6=Microsoft+ access+ > programming&c=6&s=193&.sig=crx-d4AAhdklv_VozGVAUw> access help Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+database&w1=Microsoft+ > access+developer&w2=Microsoft+access+help&w3=Microsoft+access+databas e&w4=Mi > crosoft+access+training&w5=Microsoft+access+training+course&w6=Micros oft+acc > ess+programming&c=6&s=193&.sig=qg2hDuQNweByMCX0NU7cEA> access database > Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+training&w1=Microsoft+ > access+developer&w2=Microsoft+access+help&w3=Microsoft+access+databas e&w4=Mi > crosoft+access+training&w5=Microsoft+access+training+course&w6=Micros oft+acc > ess+programming&c=6&s=193&.sig=bLZHqTqWUQny609X1OkmNA> access training > Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+training+course&w1=Mic > rosoft+access+developer&w2=Microsoft+access+help&w3=Microsoft+access+ databas > e&w4=Microsoft+access+training&w5=Microsoft+access+training+course&w6 =Micros > oft+access+programming&c=6&s=193&.sig=d8GQXfQW3RZ64rOfzIMo8A> access > training course Microsoft > <http://groups.yahoo.com/gads? t=ms&k=Microsoft+access+programming&w1=Microso > ft+access+developer&w2=Microsoft+access+help&w3=Microsoft+access+data base&w4 > =Microsoft+access+training&w5=Microsoft+access+training+course&w6=Mic rosoft+ > access+programming&c=6&s=193&.sig=iXDlL79-kkgjv6fLyFu3Sg> access programming > > > _____ > > YAHOO! GROUPS LINKS > > > > * Visit your group "AccessDevelopers > <http://groups.yahoo.com/group/AccessDevelopers> " on the web. > > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service > <http://docs.yahoo.com/info/terms/> . > > > _____ > ------------------------ Yahoo! Groups Sponsor --------------------~--> 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/q7folB/TM --------------------------------------------------------------------~-> Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/