C
Chris
Hello All,
I am trying to save the value of a primany key as a foreign key in another
table. I would normally do this by linking subforms but the form is looking
good and i have all sorts of stuff linking to it that I don't want to mess
around with.
So I am using an Insert Query to put a value into the master table. Once
this is added, a primary key is created by an autonumber. I would like to
access this primary key and store it in another table.
My first thought would be to do a select query
strSQl = "Select Top 1 SOAdetails " & _
"From tblSOADetails" & _
'"ORDER by SOAdetails Desc" & ";"
runSQL strSQl
I then discovered that I could not run the strSQL with a SELECT argument.
So now I'm trying to access the table by
Set db = CurrentDb
Set rs = db.OpenRecordset("tblSOAdetails", dbOpenDynaset)
rs.findlast (field name) ' field name is wrong argument
I think i could put a listbox on my form invisibly and access the record
from there using the correct findlast argument but I'm sure there must be a
simpler way.
Anybody willing to share one with me?
I am trying to save the value of a primany key as a foreign key in another
table. I would normally do this by linking subforms but the form is looking
good and i have all sorts of stuff linking to it that I don't want to mess
around with.
So I am using an Insert Query to put a value into the master table. Once
this is added, a primary key is created by an autonumber. I would like to
access this primary key and store it in another table.
My first thought would be to do a select query
strSQl = "Select Top 1 SOAdetails " & _
"From tblSOADetails" & _
'"ORDER by SOAdetails Desc" & ";"
runSQL strSQl
I then discovered that I could not run the strSQL with a SELECT argument.
So now I'm trying to access the table by
Set db = CurrentDb
Set rs = db.OpenRecordset("tblSOAdetails", dbOpenDynaset)
rs.findlast (field name) ' field name is wrong argument
I think i could put a listbox on my form invisibly and access the record
from there using the correct findlast argument but I'm sure there must be a
simpler way.
Anybody willing to share one with me?