Data from form to subform

B

Becky

I have a main form that has a selectbox (Tool SN) and a
subform that if populated with a subform based upon the
label that the user selects.

I want to have the user select a Tool SN and when they
pick the subform it is linked to the data in that select
box cboToolSN.

Howerver, if they enter a Tool SN that is not in the
list then I want to add that Tool SN to the table and then
have that Tool SN be populated in the subform's Tool SN so
that a new record will be created.

Tables:
tblGeneralInfo: GeneralInfoID, ToolSN, etc.
tblSystemInfo: SystemInfoID, ToolSN, etc.
tblGasInfo: GasInfoID, ToolSN, etc.
tblChamberInfo: ChamberInfoID, ToolSN, etc.
tblProcessInfo: ProcessInfoID, ToolSN, etc.

Code used to add new Tool SN to select box(not in list
event):

Dim strSQL As String, X As Integer
X = MsgBox("Do you want to add this value to the list?",
vbYesNo)
If X = vbYes Then
strSQL = "Insert Into tblGeneralInfo ([ToolSN]) values
('" & NewData & "')"
'MsgBox strsql
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If


Code used to open subform based upon label selection:

Private Sub lblGeneralInfo_Click()
Me![frmCenturaSubform].SourceObject = "frmGeneralInfo"
Me.[frmCenturaSubform].Visible = True
End Sub

Seems like I am have trouble getting these linked
together. They run fine independently.


Thanks,
Becky :)
 

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