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 VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 February 25th, 2005, 06:48 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing a varibale into a query

Hello

Does anyone know if it is possible to pass the value of a variable to a pre-defined query? If so how?

Cheers



Cheers
Tony
__________________
Cheers
Tony
Reply With Quote
  #2 (permalink)  
Old February 25th, 2005, 07:00 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

One way to do this is to have a form open with a field that contains the value. Then just point to that field using something like the following for the value in your query.

[Forms]![_frmName_].[_fldname_]

The form doesn't have to be visible, but it does have to be open.

If the user has to input the value each time the query runs you can use a syntax similar to...

[Please enter _whatever_]

And a third option is to use a function in your code.

Global xxxValueForQuery as ...

Public Function ValueForQuery () as ...
ValueForQuery = xxxValueForQuery
End Function

Before calling the query set xxxValueForQuery. In the query use ValueForQuery() wherever you need it.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
Reply With Quote
  #3 (permalink)  
Old February 25th, 2005, 08:19 AM
Authorized User
 
Join Date: Dec 2004
Location: Belfast, Antrim, United Kingdom.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great,cheers for that.

Cheers
Tony
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
Passing Value Query rsm42 ASP.NET 1.0 and 1.1 Basics 2 July 2nd, 2007 11:49 AM
Tomcat session varibale ibozo Servlets 2 June 4th, 2007 05:48 AM
Passing Variable to Query dalezjc Classic ASP Databases 2 November 14th, 2006 03:27 PM
Query Regarding passing Of Values gadhiav ASP.NET 1.0 and 1.1 Basics 5 July 16th, 2004 05:49 AM
passing input to a query mirage Access 3 October 23rd, 2003 08:43 AM



All times are GMT -4. The time now is 01:17 PM.


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