Zydeceltico
Registered User.
- Local time
- Today, 18:13
- Joined
- Dec 5, 2017
- Messages
- 843
Hi All,
We make final products out of component parts.
I have a top level form for Inspections (frmInspectionEvent). One of the clickable buttons on that form is named "Mill Inspection."
Assuming the user has chosen a job number on the main inspection form, the code for cmdOpenMillInspection_Click() is:
After clicking the button, form dsFinalProductComponents opens and let's me scroll through the various components that make the product named on the main inspection form. This part works great.
One of the fields on dsFinalProductComponents is txtPart_ID which is a numerical pointer back to a parts table key.
I need to pass this value to cboPartType on frmInspectMill via a clickable form-closing button named "Select."
cboPartType could easily be a a simple text field if that helps.
It does not need to be a cbo. Right now cboPartType is based on a qryFinalProductsComponents which returns 7 fields of data. Column 2 is PartType (the actual part name) and Column 6 has Part_ID (the key).
I know I could this with OpenArgs - BUT - - - -
frmInspectMill already uses a different OpenArgs on its Load event. Here's that code:
So I don't know how to pass the value from the previous form via OpenArgs and have a different OpenArgs happening at the same time when frmInspectMill is opened.
If you do play with the forms, you'll need to use the Undo buttons to easily back out.
Thanks in advance for all of your help.
Tim
We make final products out of component parts.
I have a top level form for Inspections (frmInspectionEvent). One of the clickable buttons on that form is named "Mill Inspection."
Assuming the user has chosen a job number on the main inspection form, the code for cmdOpenMillInspection_Click() is:
Code:
Private Sub cmdOpenMillInspection_Click()
Me.Dirty = False
If Not IsNull(Me.InspectionEvent_PK) Then
DoCmd.OpenForm "dsFinalProductComponents", , , , , acFormDS, Me.InspectionEvent_PK
DoCmd.OpenForm "frmInspectMill", , , , , acDialog, Me.InspectionEvent_PK
Me.Requery
Else
MsgBox "No Job Chosen. Parent Record Not Saved"
End If
End Sub
After clicking the button, form dsFinalProductComponents opens and let's me scroll through the various components that make the product named on the main inspection form. This part works great.
One of the fields on dsFinalProductComponents is txtPart_ID which is a numerical pointer back to a parts table key.
I need to pass this value to cboPartType on frmInspectMill via a clickable form-closing button named "Select."
cboPartType could easily be a a simple text field if that helps.
It does not need to be a cbo. Right now cboPartType is based on a qryFinalProductsComponents which returns 7 fields of data. Column 2 is PartType (the actual part name) and Column 6 has Part_ID (the key).
I know I could this with OpenArgs - BUT - - - -
frmInspectMill already uses a different OpenArgs on its Load event. Here's that code:
Code:
Private Sub Form_Load()
Dim rs As DAO.Recordset
If Not Trim(Me.OpenArgs & " ") = "" Then
'See if record exists
Set rs = Me.Recordset
'MsgBox Me.OpenArgs
rs.FindFirst "InspectionEvent_FK = " & CLng(Me.OpenArgs)
If rs.NoMatch Then 'it does not exist so you need to create it
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Me.InspectionEvent_FK = Me.OpenArgs
End If
End If
End Sub
So I don't know how to pass the value from the previous form via OpenArgs and have a different OpenArgs happening at the same time when frmInspectMill is opened.
If you do play with the forms, you'll need to use the Undo buttons to easily back out.
Thanks in advance for all of your help.
Tim