Solved

recordset query to multiple records

Posted on 2000-02-20
13
277 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 50 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mysql vs Oracle 10 120
Public Sub, Empty Cell 7 57
Pull multiple cvs files into one access table 28 57
Paint/Redraw window while dragging 16 57
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now