T
Tony Williams
I have a form, frmMain that has a subform, Subform1. On the main form is a
command button that opens a dialog box from which the user can select a
record from a dropdown list. The dialog form has a command button that when
clicked SHOULD change the record on the subform to the record with the
reference number they have selected. But it doesn't. Here is my code:
Private Sub Command2_Click()
On Error GoTo Command2_Click_Err
Dim stLinkCriteria As String
stLinkCriteria = "[VFU Code]=" & "'" & Me![VFU Code] & "'"
If IsNull(DLookup("[VFU Code]", "Offence", stLinkCriteria)) Then
MsgBox "This is not a current VFU Code.", _
vbInformation, "No Matching Record"
Else
DoCmd.OpenForm frmMain.SubForm1, , , "[VFU Code]=" & "'" & Me![VFU
Code] & "'"
End If
Command2_Click_Exit:
Exit Sub
Command2_Click_Err:
'MsgBox Error$
Response = acDataErrContinue
Resume Command2_Click_Exit
End Sub
Anyone tell me where I'm going wrong
command button that opens a dialog box from which the user can select a
record from a dropdown list. The dialog form has a command button that when
clicked SHOULD change the record on the subform to the record with the
reference number they have selected. But it doesn't. Here is my code:
Private Sub Command2_Click()
On Error GoTo Command2_Click_Err
Dim stLinkCriteria As String
stLinkCriteria = "[VFU Code]=" & "'" & Me![VFU Code] & "'"
If IsNull(DLookup("[VFU Code]", "Offence", stLinkCriteria)) Then
MsgBox "This is not a current VFU Code.", _
vbInformation, "No Matching Record"
Else
DoCmd.OpenForm frmMain.SubForm1, , , "[VFU Code]=" & "'" & Me![VFU
Code] & "'"
End If
Command2_Click_Exit:
Exit Sub
Command2_Click_Err:
'MsgBox Error$
Response = acDataErrContinue
Resume Command2_Click_Exit
End Sub
Anyone tell me where I'm going wrong