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 March 6th, 2007, 08:47 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry, that's "CurrentProject.Connection", not "CurrentPorject.Connection"

=)

mmcdonal
 
Old March 6th, 2007, 11:18 AM
Registered User
 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi mmcdonal,

Thanks, it worked!

I did catch the misspelling, and wasn't sure about it it being a command word and needing to be spelled that way, or not. So I did a google scan and then made the spelling change. Not a biggie!

My PK is two words (eg. 'Customer Number'), and that was giving me grief, so changed that to 'Customer_Number' in both tables and in the code and that resolved that.

I'm still getting a little hiccup, but it seems to be in my field names, so not sure yet if I spelled one differently in either one of the tables or the code, but should be able to resolve that tonight.

In this code, can I have multiple word field names, or do I need to link them together with something (eg. 'Customer DOB' vs. 'Customer_DOB')? If I need to link them, than that would solve the problem, and I'm guessing that is the case. As when I comment out all the fields except for the first two (eg. Date, Customer_Number), then it writes the new record (with just those two fields) to the archive file (TableB) and then deletes the record from the active file (TableA), just like I need it to do.

Again, I can't thank you enough! I've been in the business for decades, and even do SQL for internet DB's (eg. MySQL) but just couldn't get past this! Guess I'm going to need to do some more studying up! This coding is all new to me, but sure seems powerful, once you get the right functions and syntacs!

Thank you much!

 
Old March 6th, 2007, 11:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Glad to help.

SQL does not like spaces in field names, but the usual way around that if they have ended up in your design is to bracket them, so:

SELECT Customer Number FROM tblCustomer etc

becomes

SELECT [Customer Number] FROM tblCustomer etc.

Most Access developers use Pascal case on their field names, and Camel case on thier table and type names, so:

CustomerNumber for the field name
tblCustomer for the table
cboComboBox for the control name

SQL developers use caps and underscores mostly, so

CUSTOMER_NUMBER for a field name
CUSTOMER or Customer for a table name etc

HTH


mmcdonal
 
Old March 6th, 2007, 11:56 AM
Registered User
 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, that helps tons! And, it's good to know some of the standards, there's nothing better than to follow the 'norm'. Sure helps in maintenance too!

Again, I can't thank you enough!






Similar Threads
Thread Thread Starter Forum Replies Last Post
the UpdateCommand affected 0 of the expected 1 rec theRealAirness ADO.NET 0 March 28th, 2005 04:23 PM
Urgent rec navigation problems shelbygt22 Access VBA 1 March 18th, 2005 12:59 PM
Forcing a new rec in a subform from a diff form DrSnuggles Access 1 September 15th, 2004 10:13 AM
Force current rec on screen if errors exist wscheiman Access VBA 4 November 4th, 2003 02:39 PM
one rec function for multiple formats vakil Biztalk 2 August 28th, 2003 01:42 AM





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