Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 3rd, 2004, 02:01 PM
AccessNewbie AccessNewbie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 4 AccessNewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Changing the Value of a Variable in a Query using VBA

I have a report that's based on a query with a criteria for a particular field being a user specified parameter (variable). Now when you open this report it obviously asks you for the parameter but what i've done is set an [On Open] event procedure that generates a menu which asks the user to enter a number based on what he wants the report to show. Each number corresponds to a particular value that the field can take. What I want to know is how to get the value that's generated (from the user selecting a number) into the Queries perameter so it opens the report showing those fields.

-----------------------------------------------------------------------------------------
Choice:
Nature = Val(InputBox("Please Enter One of The Following Numbers : 1 , 2 , 3 or 4"))

Select Case Nature

Case 1
[Queries]![qry_nature]![User_Choice] = ""
Case 2
[Queries]![qry_nature]![User_Choice] = "Hardware"
Case 3
[Queries]![qry_nature]![User_Choice] = "Software"
Case 4
[Queries]![qry_nature]![User_Choise] = "Other"
Case Else
MsgBox "Please Enter A Valid Choice"
Resume Choice
End Select
-----------------------------------------------------------------------------------

Here's a quick one I just wrote up, but it's generally the jist of what I want to do. If you could point out any problems with this code it would be much appreciated, as you can tell from my user name i'm not that experienced with VBA. At the moment is generates : "MA can't find the field '|' referred to in your expression"

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Changing the Value of a Variable in a Query using VBA


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT