J
JohnLute
I use a button to open a form and filter to a record:
Private Sub cmdopenfgprocessing_Click()
On Error GoTo Err_cmdopenfgprocessing_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sfrmFGProcessing"
stLinkCriteria = "[txtProfileID]=" & "'" & Me![cbProfileID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdopenfgprocessing_Click:
Exit Sub
Err_cmdopenfgprocessing_Click:
MsgBox Err.Description
Resume Exit_cmdopenfgprocessing_Click
End Sub
This works fine as long as there is an existing record in the table
tblFGProcessing.txtProfileID which is the record source for sfrmFGProcessing.
How can I keep the button's current function and add a function to create a
record in tblFGProcessing.txtProfileID if one doesn't exist?
Thanks!
Private Sub cmdopenfgprocessing_Click()
On Error GoTo Err_cmdopenfgprocessing_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "sfrmFGProcessing"
stLinkCriteria = "[txtProfileID]=" & "'" & Me![cbProfileID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdopenfgprocessing_Click:
Exit Sub
Err_cmdopenfgprocessing_Click:
MsgBox Err.Description
Resume Exit_cmdopenfgprocessing_Click
End Sub
This works fine as long as there is an existing record in the table
tblFGProcessing.txtProfileID which is the record source for sfrmFGProcessing.
How can I keep the button's current function and add a function to create a
record in tblFGProcessing.txtProfileID if one doesn't exist?
Thanks!