form creating new row in table1, looking for field value in table

G

Guest

Please can someone help as I have been battling all week with this problem,
and haven't had a response.

I have a form which uses some data from table1 to create an entry in table2
(i know duplication is bad, but as this is a live database, and i am working
on a new section, this makes this complicated task easier), which works fine.
however, i have a third table that has the unique ID from table1 and table2
in order to show when a table1 row of data is needed in table2 via a
checkbox. This third table3 is created when elsewhere.

The problem lies with bringing in the unique ID value from table2 and puting
it in the same row as the unique ID value from table 1, into table 3. eg:

table1
UID = 12345

table2
UID = 6789

table3
UID = 1
tbl1-UDI = 12345
tbl2-UDI =

the code i use when opening the form is as follows: (text126 pulls the value
of UID1)

Dim badger As String
Dim LinkID As Long

badger = Me.NameData & ";" & Me.dteStartDate & ";" & Me.dteEndDate & ";" &
Me.Text126

DoEvents
LinkID = DLookup("UID2", "table3", "[UID1]=" & Me.Text126)

On Error GoTo ErrorHandle
DoCmd.OpenForm "frm_TRA_AddBooking", , , "[NameData ]=" & Me![NameData],
acFormAdd, , badger

I am guessing it is something to do with the form creating an autonumber for
table2, and not being able to use that value until after the form is closed,
however I have tried passing over the value to a second form, and that does
not pass it over either.(text54 calls the value of UID2 which pulls from the
table)

Dim DayDataInfo As String

DayDataInfo = Forms!frm_TRA_AddBooking!UID2;" &
Forms!frm_TRA_AddBooking!UID1;" & Forms!frm_TRA_AddBooking!Text54

DoCmd.OpenForm "frm_TRA_DayData"

I would be very grateful if someone would help me with this (providing I
have explained it clearly enough)
 
G

Guest

Don't worry, I fixed it via some tweaking elsewhere, and by passing the
openargs over in the correct bit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top