Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference Column to Row in VB

Status
Not open for further replies.

bugzLue

IS-IT--Management
Feb 27, 2001
57
0
0
US
Can anyone help me with VB code for Access or SQL?
I need to be able to reference one column to the primary column and output the row from the primary column.

so if po_id is 2 then it will go over to ID column look for 2 and row 2 prints out.

ID (PK)

PO_ID
PE_ID

ID Name Address CSZ PO_ID PE_ID
1 Bla bla 123 bla Any 999999 1 4
2 Ha HA 234 ha Mine 88888 1 3
3 ME me 345 City NY 11111 2 1
4 See 456 SD Ca 99211 3 2


Thank if you can help Live to learn or die trying
 
ummmm ... if i understand this right then

'---- 1st select stmt

Set rs = db.OpenRecordset(Select * from <<table>>)

'--- loop through records
Do while rs.EOF = False

if rs(&quot;po_id&quot;) = &quot;2&quot; then

Set rs = db.OpenRecordset(Select * from <<table>> where id='2')

'=== here u can print or write to a file etc in a loop
end if
rs.movenext
loop

this above code is assuming u know DAO and stuff
else write back

[cheers]
Niraj [noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top