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 / July 2006

Tip: Looking for answers? Try searching our database.

Use variable in sql

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 12 Jul 2006 01:25 GMT
If I use the code below, records are deleted from my table if I replace
tblModel with the name of a real table.  However, I need to use a table
variable instead.  I've set it with tblModel, which gives the correct table
name, but it doesn't work within my RunSQL.  Any ideas how I can use a table
variable? Thanks much.

Private Sub Command4_Click

tblModel = "Export" & [Forms]![Export_Ref_Parts]![ModelToImport]

DoCmd.RunSQL "Delete tblModel WHERE ((([Part#]) Is Null));"

End Sub
Douglas J. Steele - 12 Jul 2006 01:32 GMT
DoCmd.RunSQL "Delete " & tblModel & " WHERE ((([Part#]) Is Null));"

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> If I use the code below, records are deleted from my table if I replace
> tblModel with the name of a real table.  However, I need to use a table
[quoted text clipped - 11 lines]
>
> End Sub
david epsom dot com dot au - 31 Jul 2006 12:32 GMT
Waiting for trouble using # in a field or table name, because # is also
sometimes used as an alias for . dot. Expect trouble just when you least
expect it.

(david)

> If I use the code below, records are deleted from my table if I replace
> tblModel with the name of a real table.  However, I need to use a table
[quoted text clipped - 11 lines]
>
> End Sub
 
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.