Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-08-2008, 08:21 AM
Novice
 
Join Date: Jul 2008
Location: St. Louis, Mo
Posts: 1
synapse5150 is on a distinguished road
Default Variable question

I am using Access to populate an Excel sheet, and someone around here came up with the idea of storing SQL statements in an Access database. The proble is, sometimes we need to use variables in our SQL statements. So the SQL statement 'Select * from Hdr_Reports' stores and runs fine, but if we need to store 'Select * from Hdr_Reports where Report_Name = ' & VaribleName & ', we can figure out how to make VBA read the line correctly. It translates it all to a literal string. Any idea how to get around this? Thanks in advance for your help.
Reply With Quote
  #2  
Old 07-09-2008, 07:17 AM
jya jya is offline Windows XP Access 2007 (version 12.0)
Competent Performer
 
Join Date: Sep 2007
Location: Chicagoland
Posts: 109
jya is an unknown quantity at this point
Default

Did you try this?

'Select * from Hdr_Reports where Report_Name = "' & VariableName & '"'
Reply With Quote
Reply

Bookmarks

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a value from a variable to an update query MUKUDU99 Programming 0 08-24-2008 10:14 PM
Need help - Record set based on a program variable ericargent Programming 1 09-19-2007 07:57 PM
pass a variable to the MsgBox function 3dmgirl Programming 2 04-19-2007 06:14 AM


All times are GMT -8. The time now is 05:36 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.