Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 5th, 2006, 06:03 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default missing semicolon

INSERT INTO ClassAndUnit (ClassID, UnitID)
VALUES (#form.ClassID#, #form.UnitID1#)
WHERE (((ClassAndUnit.ClassID)=#form.ClassID#) AND ((ClassAndUnit.UnitID)=#form.UnitID1#));

i have this for my code n its just giving an error missing semicolon at the end of the sql statement. ive tried putting the semicolon everywhere, but its just not working.

Reply With Quote
  #2 (permalink)  
Old May 5th, 2006, 10:01 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Where are you using this SQL?
Is this the argument to a <connection>.Execute statement?
Is this the text of a named query?

What does “form” refer to in “#form.ClassID#” (et al.)?
I’m not familiar with the use you’re making of pound signs (“#”). I thought their purpose was to delimit dates, but it appears from this context that they can be used to get SQL in a form’s module to extract data from the form; Is that correct?
Reply With Quote
  #3 (permalink)  
Old May 5th, 2006, 10:10 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Brian poses good questions. What is this #form.ClassID# structure? It doesn't look familiar. If you're using the DoCmd.RunSQL method with fields from the active form, it should look something like this:

DoCmd.RunSQL "INSERT INTO ClassAndUnit (ClassID, UnitID) VALUES (" & Me.ClassID & ", " & Me.UnitID1 & " WHERE (((ClassAndUnit.ClassID) = " & Me.ClassID & " AND ((ClassAndUnit.UnitID) = " & Me.UnitID1 & "));"

if the IDs are numbers or

DoCmd.RunSQL "INSERT INTO ClassAndUnit (ClassID, UnitID) VALUES (" & Me.ClassID & ", " & Me.UnitID1 & " WHERE (((ClassAndUnit.ClassID) = '" & Me.ClassID & "' AND ((ClassAndUnit.UnitID) = '" & Me.UnitID1 & "'));"

if the IDs are text.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
splitting up items separated by semicolon Condor76 XSLT 1 March 17th, 2008 05:14 PM
hi pls help on this semicolon data arvind@allfon XML 5 February 20th, 2007 08:09 AM
What is missing? grstad SQL Language 11 March 6th, 2006 01:53 AM
Missing semicolon? jakeone Access 4 February 15th, 2005 12:26 PM
what am i missing? m002864 Crystal Reports 0 July 6th, 2004 07:24 AM



All times are GMT -4. The time now is 11:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.