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 February 4th, 2004, 05:41 PM
Iraq n Baq Iraq n Baq is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Columbia, Missouri
Posts: 34 Iraq n Baq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 34 m 50 sec
Reputation Power: 5
Send a message via AIM to Iraq n Baq
Update Combo Box RowSource

I'm using the following code ('borrowed' and modified from TBÁrpi) to update the RowSource of a secondary combo box based on the selection in the primary combo box. TYPEEQUIP is the primary selection and MODEL is the secondary. Both combo boxes are on form frm_Inventory.

<code>
Private Sub TYPEEQUIP_AfterUpdate()
Dim strRowSource As String
strRowSource = "SELECT qry_HardwareType.model FROM qry_HardwareType WHERE qry_HardwareType.typeequipcode=frm_Inventory.TYPEE QUIP"
Me.MODEL.RowSource = strRowSource
Me.Repaint
End Sub
</code>

This will try to update the RowSource of MODEL, but instead of looking in frm_Inventory.TYPEEQUIP for the value to work with, I'm prompted for the value ("Enter Parameter Value" - "frm_Inventory.TYPEEQUIP" is the message in the parameter prompt box).

My VB skills are bad/nonexistent, so I may be missing something fairly simple. Also, this was originally provided as a solution to a similar question involving a list box instead the secondary combo box. Don't know if list vs. combo box matters here...

TYPEEQUIP has 2 columns in its RowSource. The first column, that will match values in qry_HardwareType.typeequipcode, is hidden, and the second displays a user friendly interpretation of the code. This field sucessfully stores the correct equip code in the table for the user friendly interpretation selected. This probably doesn't matter, just trying to provide as many possible causes as possible.

Any ideas on what I'm doing wrong?
__________________
--Slaughter
slaughter@mizzou.edu

Reply With Quote
  #2  
Old February 5th, 2004, 11:13 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Here is a very easy and clean way of doing what you are asking

look at frmsales

S-

Reply With Quote
  #3  
Old February 5th, 2004, 12:11 PM
Iraq n Baq Iraq n Baq is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Columbia, Missouri
Posts: 34 Iraq n Baq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 34 m 50 sec
Reputation Power: 5
Send a message via AIM to Iraq n Baq
You, my friend, are a demi-god. Like I said, something fairly simple that I'm not quite advanced enough to know much about. I've been tooling with that for days.

Appendix to Question:
Now, I have two other fields that I'd like to populate from the results of Combo2 (from the qry used by combo2). They each can only have 1 value for each outcome of Combo2 (They're the Manufacturer and Series of the selected Model [in Combo2]). I can get the values to display properly in a one line list box (fieldname.Requery in the Combo2 After_Update event), but the values don't get stored to the table unless I click on them. Is there a simple VB command to select the displayed values in a list box?

Reply With Quote
  #4  
Old February 5th, 2004, 12:42 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
It sound like what you want to do is select your item from the first dropdown and instead of actually displaying items in the list box to be selected, you want to directly add that entire list (that would have shown in the listbox) to your table. IS this correct

S-

Reply With Quote
  #5  
Old February 5th, 2004, 12:49 PM
Iraq n Baq Iraq n Baq is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Columbia, Missouri
Posts: 34 Iraq n Baq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 34 m 50 sec
Reputation Power: 5
Send a message via AIM to Iraq n Baq
Correct. Adding the 'entire' list consists of one line, but yes, that is accurate. I want to commit the list options to the table.

Reply With Quote
  #6  
Old February 5th, 2004, 12:54 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
how comfortable are you with VBA?

S-

Reply With Quote
  #7  
Old February 5th, 2004, 01:50 PM
Iraq n Baq Iraq n Baq is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Columbia, Missouri
Posts: 34 Iraq n Baq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 34 m 50 sec
Reputation Power: 5
Send a message via AIM to Iraq n Baq
can't write from scratch, but i can usually understand something if i see it.

Reply With Quote
  #8  
Old February 5th, 2004, 03:07 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Without knowing what your current forms look like. You have two options

option1 - full use of ADO or DAO
You will write VBA using DAO or ADO recordsets. You will use the criteria in the intial combobox to generate the criteria for the SQL Code you will use in VBA, You will openup a recordset, based on teh SQL code, take the information from this recordset (that you want to add to another table), close the recordset, open another recordset to the table you wish to add the information to, add the record, close the recordset and you are done. The following link as a sampel DB or mine uploaded on it that you can download to look at use recordsets in VBA. DB is called vbaunbound

http://forums.aspfree.com/showthread.php?t=23043

option2 - use queries and recordset
You create a query, that when run will add your record to the table, that will use the criteria based in yoru first cmbobox. Then you use VBA to execute the query in code.


Either option has it good and Bad points.

Let me know which on you would like to try and I will help you.

S-

Reply With Quote
  #9  
Old February 5th, 2004, 05:45 PM
Iraq n Baq Iraq n Baq is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Columbia, Missouri
Posts: 34 Iraq n Baq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 34 m 50 sec
Reputation Power: 5
Send a message via AIM to Iraq n Baq
I won't be adding that many records to make that much coding/extra work worthwhile (I've probably already crossed that line). I can deal with *click click* to get the values into the fields. The big use for what I'm building is to verify inventory - hopefully our records are accurate enough that I don't have to add anything!

Thanks for your help though.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Update Combo Box RowSource


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