Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2005, 10:50 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default use vba to add a row to datasheet

I could use a pointer, I spent the past 2 days trying to get a form in Microsoft Access to use VBA to Create a new record from an Access Datasheet view, I am scanning a barcode in a combo box with a carriage return, then using on_exit to set focus to the next textbox that has a query combining the title, condition, description and price from the bar_code_id. The problem I am having is that I want the datasheet to then start a new blank line ready to accept another barcode input, I cannot get it to open a new row. If I inhibit the on_exit function of the combo box all I have to do is press the enter key a new blank row is opened with the cursor in the right position and I am ready for another barcode but I don’t perform the query. Any suggestions would be greatly appreciated.


 
Old July 11th, 2005, 09:57 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Move to the last row, then movenext.

To discover the code to do this, create a macro that does this (using the drop-downs that the macro editor provides), then convert the macro to a procedure.

Alternatively, you could create a button on the form which adds a new record using the control wizard, then utilize the code the wizard generates for creating a new record in creating a new record through your process.
 
Old July 11th, 2005, 01:07 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian,
 Thank you for the feedback, It is amazing how something so simple could elude me for so long. I used the button wizard to add a new record an then cut and pasted the code. I had already tried, Move to the last row, then move next in code, that did not work. I don't know how to use the macro builder, so I didn't even try that.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating Input from a Datasheet using VBA digby_dog Access VBA 1 October 6th, 2008 10:35 AM
Fill datasheet/Continuous form with vba code only Galateo Access VBA 0 May 9th, 2008 09:39 AM
Re: Add button on a form with datasheet view lxu Access 5 March 8th, 2004 06:19 PM
Datasheet View Auto Highlight a Row Dataman Access VBA 0 February 15th, 2004 11:16 AM
Datasheet View Column Width - VBA Dataman Access 1 February 5th, 2004 02:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.