[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

recordset query to multiple records

Posted on 2000-02-20
13
Medium Priority
?
287 Views
Last Modified: 2010-05-02
I have a table in access that consists of three columns.
column headings: Heading,Key,SupplierKey

I open a recordset from my form to select * from table WHERE SupplierKey = "something"
This recordset fills up a combobox

Combobox_click event
When I select an item in the combobox, I want the recordset to move to a record in the recordset where the combobox.text returns the value of recordset!Key (this will be the value for text1.text)

How do I do this. Please help!
I thought about INNER JOIN, but I don't want to join two tables.
The 'Heading' column can have the same value e.g Keyboards, but the 'Key' column identifies which record I want.
The reason I am selecting records from the 'SupplierKey' column to open the recordset, is because this is being selected from a different combobox.  

Thanks for the answer!!!
0
Comment
Question by:andre_vil
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2540413
Ok let me understand this right. The comboBox gets filled correct ? Then when selecting an item from it you want to show a value for selected item? is this right ?
0
 
LVL 6

Expert Comment

by:esolve
ID: 2540468
The combobox gets filled correct!
When I select an item it displays the record's 'heading'. With this displayed, I want to fill up a textbox with the record's correspondent 'key'.

Since the recordset is open I can show any value for recordset!Key with the following code:

rs.movefirst
text1.text = rs!key

this returns the first value for 'key' but not the record which is selected in the combobox!

help!
 
0
 
LVL 6

Expert Comment

by:Marine
ID: 2540476
Ok try this so in your listbox click event place this
and read it form a recordset on every click on the item
select Key from table WHERE SupplierKey =" & list1.listindex
and just assign that value to your textbox.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:esolve
ID: 2540532
When I do this I have to open a new recordset.
I want to do something like this:
SELECT key FROM previousRecordset WHERE SupplierKey = combobox.text
I know this wouldn't work but since I have selected items from the table, I have to query these items again to get the records I want.

Hope you understand what I want to do!
Thanks
0
 

Author Comment

by:andre_vil
ID: 2540546
Adjusted points to 50
0
 
LVL 6

Expert Comment

by:Marine
ID: 2540556
You will still have to query to get the selected record from to combo. Thats why i suggestd to open a new recordset.
SELECT key FROM previousRecordset WHERE SupplierKey =" & combobox.ListIndex
0
 

Author Comment

by:andre_vil
ID: 2540565
Can you make a query to two items from a record in a table.
i.e SELECT key, supplierkey FROM table WHERE key = "" and supplierkey = "" 
0
 
LVL 6

Expert Comment

by:Marine
ID: 2540590
yes you can .
I don't know if your fields are numeric type or string so this one is for numeric
rs = "SELECT From table where key=" & combo1 & "AND" & setkeys = " & combo1"

and this one for string
rs2 = "SELECT * FROM TABLE where table1='" & text1.Text & "' & " And " & setkeyset='" & text2.Text & "'"
0
 

Expert Comment

by:TT
ID: 2540938
U can try this,
  rs.FindFirst "SupplierKey = '" & _
      Combo1.Text & "'"    
  If Not rs.NoMatch() then
      Text1.text = rs.Key
  EndIf
0
 
LVL 6

Expert Comment

by:Marine
ID: 2540981
He needs to serach by 2 feilds . If he is using ADO theer is no fiddifsrt also find can search one creteria . Must use Filter 2 search more
0
 

Accepted Solution

by:
sonere earned 150 total points
ID: 2541718
You use a text box depends on adodc1 (datasource) and datafield key

when the recordset order and combobox is the same and after combo1 click


Adodc1.Recordset.AbsolutePosition = Combo1.ListIndex + 1

write this statement
You can see the key in the text box

best wishes.

Sonere
0
 

Author Comment

by:andre_vil
ID: 2543252
Thanks a lot Sonere!
This is what I want. i am not using a ADOData control, but it applies to my project as well.

Regards
André
0
 

Expert Comment

by:sonere
ID: 2543787
Dear andre_vil,

Nice to see your comment like this. Good programs in VB



0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question