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 October 4th, 2004, 04:40 PM
joel_jta joel_jta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 3 joel_jta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile how can i select from my combo box?

Pls help me... on how can I select data from my combo box and pass the selected list to the other form? can you please give me a sample code. Many Thanks.

Reply With Quote
  #2  
Old October 4th, 2004, 06:31 PM
ineuw ineuw is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 82 ineuw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 28 sec
Reputation Power: 5
You can transfer the selected combo box value to another control of any open form by using the AfterUpdate event of the combo box.

Assuming that the name of the combo box is [ComboBox] and the control name is [TextBox] and the form to be transfered to is named [OpenForm], this is what the code would be:

Sub ComboBox_AfterUpdate()

Forms![OpenForm]![TextBox].Value = Me![ComboBox].Value
OR
Forms![OpenForm]![TextBox] = Me![ComboBox]

End Sub

Note: The reference .Value is optional.

Reply With Quote
  #3  
Old October 4th, 2004, 07:31 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Another option without code would be to make the default value of your textbox to equal the combobox value providing that the form in which your combobox is on remains open when you open your second form. If your second form is already open you will need to refresh the form to see the results.

=[Form]![ComboBoxForm]![ComboBox].Value

Depending on your program flow there are several different ways to approach this. If you need specific help with your particular forms, give us more detail in how you are executing opening the second form from your first form and what is in your combobox, i.e. number of columns etc.

lwells

Reply With Quote
  #4  
Old November 6th, 2004, 07:11 PM
Ramjet Ramjet is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Ramjet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Combobox Query kinda works..help!

Ok, I have a form with unbound combo boxes that collect the user options to return data from a query. If I compete ALL the fields by choosing from the combo boxes I get the correct data returned to me.

However, I am trying to create a completely customized report from this query so for instance...

BOX A - TYPE OF ASSET
BOX B - TYPE OF PROBLEM
BOX C - FOR LAST X NUMBER DAYS

If I devide I want all the record for the type of assett in the last 30 days and pick the type of assett in box a and 30 days in box c, then leave box B as the default value, currently NULL. then I get no data back.

What I want back for data is all records of that assett type, for that date period, with all types of problems. And vice versa with all boxes. totally user definable report. The only thing I want to force them to do is pick at least one assett type, otherwise they can have all of the data on that assett or limit it as they see fit.

Thanks in advance

Reply With Quote
  #5  
Old November 7th, 2004, 09:20 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Ramjet

You can use the code I gave qazig in their post to guide you on building a QBF (query by form) In your case you would force the entry of the BoxA - Type of Asset by using the following in the OnClick of the command button prior to running the Function

If IsNull(BoxA) Then
Msgbox "Must Make An Asset Selection First"
DoCmd.CancelEvent
BoxA.SetFocus
End If

lwells

Reply With Quote
  #6  
Old November 8th, 2004, 03:51 AM
Ramjet Ramjet is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 Ramjet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, that will force the one box input. I am still having problems with the null fields in the other boxes not returning a report. I have used a parameter query based on the combo boxes and if they are all not complete it does not produce any data. I have tried setting the criteria in the query to [FORMS]![THATFORM] or If Null Like "*" hoping that if the field is null it will use the wildcard to return all of the data for that field. I want the combo boxes to drill down the data on the specifics for the user, otherwise if there is no criteria defined by the user they get all of the data for that field.




Quote:
Originally Posted by lwells
Hi Ramjet

You can use the code I gave qazig in their post to guide you on building a QBF (query by form) In your case you would force the entry of the BoxA - Type of Asset by using the following in the OnClick of the command button prior to running the Function

If IsNull(BoxA) Then
Msgbox "Must Make An Asset Selection First"
DoCmd.CancelEvent
BoxA.SetFocus
End If

lwells

Reply With Quote
  #7  
Old November 8th, 2004, 12:02 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Ramjet

If you will look at the code I gave qazig in their post, it has the code to handle Null values like you want.

Thread
http://forums.devarticles.com/t10699/s.html

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > how can i select from my combo box?


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