Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

help with sql query !

$
0
0
on my form i have a 'yes' button. this form has an id num on it. When the user clicks the yes button another form opens with a new id number. say the id number on the fiorst form is 1 and the id on the second form is 2.

I then do an insert into my linked so it stores

Code:

Prev_id          new_id
1                        2

Then the user can press the yes button on the second form and open a 3rd form and open anther form with a new id so the table now looks like this:

Code:

Prev_id          new_id
1                        2
2                        3

This can go on as many times as the user clicks on the new forms opened so the table could end up looking like this:
Code:

Prev_id          new_id
1                        2
2                        3
3                        4
4                        5
5                        6


i need to write some code which gets the original form id which would be 1..however i cant get my head aroud how i need to do it


so far i have done

PrevSQL="SELECT Prev_id from linked where id='" & txtId.Text & '"
'i then open the recordset and assign the variable prevTest to the value returned in the rs.

I know that i then need to
select prev_id from previous where id=prev test

and i think i need a loop somewhere... can anyone help me with this please!!

Thanks!

Viewing all articles
Browse latest Browse all 21273

Trending Articles