Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2007

Tip: Looking for answers? Try searching our database.

Insert Into Query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
newby - 18 May 2007 14:55 GMT
I have three buttons on a nomination form, if users click on any of the
button I want the contact name and other information for that particular
record to be inserted into a table. I used the following code:

Dim SQL As String
Dim strWhere As String

strWhere = Me.Contact_LastName

   SQL = "INSERT INTO tblteams " & _
      "(teamname) " & _
      "SELECT Contact_LastName FROM Results Where =" & strWhere & "'"
     
      DoCmd.RunSQL SQL
     
But it keeps giving me syntax error in the Where clause can someone please
help me?

Thanks

Signature

TO

Dennis - 18 May 2007 15:05 GMT
You are missing your field name from your results table and the opening
single quote
"SELECT Contact_LastName FROM Results Where [FieldName]='" & strWhere & "'"

> I have three buttons on a nomination form, if users click on any of the
> button I want the contact name and other information for that particular
[quoted text clipped - 15 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.