Arkawa72
asked on
Access VBA compile error
I get a "compile error: argument not optional" when I run the following macro in Access 2000
Echo = "SELECT * INTO Echo FROM Delta LEFT JOIN BookingOfficeregion ON Delta.bookingoffice=Bookin gofficereg ion.Bookin gOfficeDes cription;"
DoCmd.RunSQL Echo
If I just run the query in the query menu, I get no errors. Any ideas?
Echo = "SELECT * INTO Echo FROM Delta LEFT JOIN BookingOfficeregion ON Delta.bookingoffice=Bookin
DoCmd.RunSQL Echo
If I just run the query in the query menu, I get no errors. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't use Echo for a variable name - it's an Access VBA method.
Try something like strSQL - it kind of tells you what the variable is for.
Try something like strSQL - it kind of tells you what the variable is for.
Generally, you should pick your variable names carefully, and give them meaningful prefixes to avoid problems like this.
For example, prefix integer names with 'int', string with 'str', textboxes with 'txt'... etc)
intMyinteger
strMyString
txtMyTextbox
cboMyComboBox
Take a look at these standards (many of the Experts here use these):
http://www.xoc.net/standards/rvbanc.asp
Naming conventions specific to Access are midway down the page.
For example, prefix integer names with 'int', string with 'str', textboxes with 'txt'... etc)
intMyinteger
strMyString
txtMyTextbox
cboMyComboBox
Take a look at these standards (many of the Experts here use these):
http://www.xoc.net/standards/rvbanc.asp
Naming conventions specific to Access are midway down the page.
Open in new window
(Echo is a vba command. Dont use it as a variable name)