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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go To Next Record

Status
Not open for further replies.

Aby123

Vendor
Apr 26, 2005
4
GB
Hi

I’m a novice :) and this is a simple answer but here goes. I’ve created a form in access 2002 with two columns. I use a bar code scanner to scan the tracking number and order number but I can't get the database to automatically go to the next record I have to do it manually using insert new record. Is there a way of moving to the next record as soon as I have scanned the second column?
 
aby,
IF and only if your scans, before going to the next record, are all the same length you can set the input mask to the number of digits in the barcode. If they are of different lengths try the "on change" in the "event" tab of the property sheet. Click "on Change" then click on the ... at the right side of the property, click "code builder" and enter. Where the cursor is blinking, enter:
docmd.GoToRecord ,,acnext
 
Thanks for the reply! I tried what you suggested but every time I scan the code (docmd.GoToRecord ,,acnext)comes up and is highlighlted yellow. I have I missed something out in the code?

Thanks
 
Probably...
Code:
Private Sub Form_AfterUpdate()
    DoCmd.GoToRecord , , acNewRec
End Sub


________________________________________
Zameer Abdulla
Visit Me
There is only one perfect child in this world. Every mother has it.
 
i tried that now ZmrAbdulla and it does not go to the next record. Ok , may be im doing something simple wrong here. I go to the properties of the second column and then event, click on on change, event procedure comes up and then in the visaul basic scren choose the column that I am in in the left upper screen and the on chnage in the right. God I hate access!
 
How are ya Aby123 . . . . .

The [blue]OnChange[/blue] Event is a [blue]very bad choice[/blue] for your task. Although it logically fits what you desire to accomplish, [purple]it has serious problems with changing focus[/purple] (no matter how its done).

[blue]xaf294[/purple] has already mentioned using the [blue]Input Mask[/blue] of the control (providing your barcode input is of static length), but there's a little more to it. You need to set the [blue]AutoTab[/blue] property of the control to [purple]Yes[/purple], and using the [blue]OnEnter[/blue] or [blue]GotFocus[/blue] events of the [blue]next control in the Tab Order[/blue], you set code to goto the next or new line.

BTW, to get to the proper event procedure:
[ol][blue][li]Put the cursor in the event line of interest.[/li]
[li] Then click the three elipses
Elipses.BMP
just to the right.[/li][/blue][/ol]
This will take you to the event in the VBE editor window with the cursor in place. To return to Form Design View press [purple]Alt + Q[/purple].


Calvin.gif
See Ya! . . . . . .
 
aby, if you copied the docmd.GoToRecord ,,acnext it, possibly did not put spaces between the commas and the acnext. it needs to be;
docmd.GoToRecord , , acnext
jim
 
Aby123 . . . . .

In my last post I should've said: the [blue]AfterUpdate[/blue] event of BarCode control . . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks a lot guys! I have tried everything now. I have placed the code docmd.GoToRecord , , acnext in the after update section. It comes up with an error cannot find record. Done everything that TheAceMan1 suggested accept " next control in the Tab Order, you set code to goto the next or new line." I think that means you enter docmd.GoToRecord , , acnext where the cursor flashes! Any further help would be most appreciated otherwise im going to have get help tomorrow!

 
And what about acNewRec instead of acNext ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Aby123 . . . . .

I'll be clearer. [blue]For the textbox that receives the barbode:[/blue]
[ol][li]In the [blue]InputMask[/blue] property, enter [purple]# symbols[/purple] for the barcode length. A character length of 9 would be [purple]#########[/purple].[/li]
[li]Set the [blue]AutoTab[/blue] property to Yes.[/li]
[li]Put you code in the [blue]AfterUpdate[/blue] event.
Code:
[blue]   docmd.GoToRecord , , acNewRec
   Me!BarCodeTextboxname.SetFocus[/blue]
[/li][/ol]


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

Part and Inventory Search

Sponsor

Back
Top