Wrox Programmer Forums
|
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 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 May 5th, 2006, 06:03 AM
Registered User
 
Join Date: May 2006
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.

 
Old May 5th, 2006, 10:01 AM
Friend of Wrox
 
Join Date: Nov 2004
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?
 
Old May 5th, 2006, 10:10 AM
Friend of Wrox
 
Join Date: Jun 2003
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





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





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