This is killing me...

KingRudeDog

Registered User.
Local time
Today, 12:03
Joined
May 12, 2006
Messages
36
Okay.

I have a main form TRequests, which has several subforms, although we are dealing with two here in particular.

I have one subform [bsdata] that has combo's to choose data and a [enter] button to submit.

This updates the second subform (query table) with a [PK] and further metadata...

I would like to have the [enter] key from the first subform, also open a pop-up [addnew] (no biggie) and enter the newly created [PK] in a field that I normally have to enter it in manually.

I would like to accomplish this before the data updates to the query table showing the results.

Pulling hair out.
 
I'm assuming by an "Enter key" you are refering to a command button... Should be something like this... Your click will open your second form ....and in this case copy the "JobID" field to the second form.

Private Sub cmdOpenNewForm_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "SecondForm"
DoCmd.OpenForm stDocName, , , , acFormAdd

Forms![SecondForm]![JobID] = Forms![FirstForm]![JobID]

End Sub


Give that a try............
 
Tried your suggestion (as shown below).

Kept getting the error "MS Office can't find the field "l" referred to in your expression..."

I posted the expression i edited from your suggestion below. Do you see any errors of note?



Private Sub Command32_Click()
On Error GoTo Err_Command32_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.GoToRecord , , acNext
DoCmd.Requery

stDocName = "TRAddSectionMaterials_frm"
DoCmd.OpenForm stDocName, , , , acFormAdd

Forms![TRAddSectionMaterials_frm]![body_style_PK] = [body_style_data_frm]![body_style_PK]

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom