Hello,
I am having an issue with my vba while following Dev Ashish's site http://access.mvps.org/access/general/gen0018.htm
My Dlookup works correctly, from what I have tested. The issue comes from when I run the update query after, it updates every record instead of the current record. Can anyone point me in the right direction?
The after update vba: (keep in mind MemberID is a text field)
Update Query
Do I need to run the dlookup in the update query to limit to the specific record based on the form?
I am having an issue with my vba while following Dev Ashish's site http://access.mvps.org/access/general/gen0018.htm
My Dlookup works correctly, from what I have tested. The issue comes from when I run the update query after, it updates every record instead of the current record. Can anyone point me in the right direction?
The after update vba: (keep in mind MemberID is a text field)
Code:
Private Sub Combo59_AfterUpdate()
Response = MsgBox("Do you want update this individuals program?", vbYesNo + vbQuestion, "Update Program")
If Response = vbYes Then
If DLookup("MemberID", "tblMemberProgram", "[MemberID] = '" & [Forms]![FRM_Member_Stats].[MemberID] & "'") > 0 Then
'MsgBox "Record exist"
DoCmd.OpenQuery "UpdateProgram"
Else
MsgBox "Record does not exist"
' DoCmd.OpenQuery "AppendProgram"
End If
End If
End Sub
Update Query
Code:
UPDATE tblMemberProgram SET tblMemberProgram.ProgramOffice = [Forms].[FRM_Member_Stats].[Combo59];
Do I need to run the dlookup in the update query to limit to the specific record based on the form?