Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 19th, 2006, 11:11 AM
KNIA KNIA is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 KNIA User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 35 sec
Reputation Power: 0
Multiple parameters from 1 combo value

Hi all.

I've got a combo box set up with values X,Y,Z.
When the user clicks on X, a hidden textbox gets populated with values "1 Or 2 Or 3" and I reference that textbox in the query criteria field.

The problem is I haven't had any success with it.
If the textbox=only one value, the query works fine.
If I try to use more than one value, nothing happens.
I've tried every variation I can think of "[1] Or [2] Or [3]"
What am I missing?
Any advice will be most appreciated. Thanks!

Reply With Quote
  #2  
Old June 20th, 2006, 03:58 AM
Sanguine Sanguine is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: U.P., India
Posts: 6 Sanguine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 13 m 11 sec
Reputation Power: 0
Hi Knia,
Could you please be a bit more specific to ur problem.Your problem is not clear..Are you having more than one combo boxes or using a single combo with multiple selection..in any case you can use that vaue only in ur query criteria..i am not understanding y r u using hidden text box for that...

Reply With Quote
  #3  
Old June 20th, 2006, 08:53 AM
KNIA KNIA is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 KNIA User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 35 sec
Reputation Power: 0
Hi Sanguine. Sorry if I was unclear. I'll try to be more specific.

I have a switchboard form that's set up with 1 combo box.
The values in the combo box represent cost centers.
I have the form password protected so that when a manager selects their cost center and gives the correct password, they are taken to another form that acts as a second switchboard where they can pull various reports for their team.
That's where the hidden textbox comes in. I populate the textbox with the value from the combo box so the main switchboard form can be closed. Then I reference the textbox value in the queries' cost center criteria field so that they only see information for their own cost centers.
(ex/ If the cost center is 08X, the textbox value = "08X". The query references the textbox in the criteria field.)
And this works GREAT if there's only one cost center.

My issue is I don't know how to code it so that the textbox can equal more than one cost center at the same time.
For instance, under a certain cost center (10X) there are 3 other cost centers that report to it (01X,02X,05X).
How can I code it so that the textbox value gets referenced in the query criteria field as "01X" Or "02X" Or "5X"?

Thanks for your help!

Reply With Quote
  #4  
Old June 23rd, 2006, 03:56 AM
Useless Useless is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 9 Useless User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 45 m 21 sec
Reputation Power: 0
Hi,
I would try to split the string in the text box into individual variables and then compile them into one string, formatted as a query. The string should be easily split by the ',' and you could count the number of comma's to tell you how many variables are required for the query. eg 2 commas means there are three variables so the query would be
Select * FROM tablename where field = " & str1 & " or " & str2 " or " str3.
I think you can define variables on the fly in VB, otherwise define the max amount you know you will need. It will be important to have some way of counting how many variables are required so you know what to include in the query statement if you are not confident of checking for a null string before appending it to the statement in a loop.

See how you go. I cant be of much help in writing code for you as I am new to VB syntax.

Reply With Quote
  #5  
Old June 23rd, 2006, 08:12 AM
KNIA KNIA is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 KNIA User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 35 sec
Reputation Power: 0
Thanks Useless.
I'll give it a shot.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Multiple parameters from 1 combo value


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 2 hosted by Hostway
Stay green...Green IT