Hi, I think the answer is probably very simple but I can't seem to get this to work so hope someone can help.... I want to run an append query to add a new record to a table on close of form when a condition is met in a textbox in my form. VBA is not my strong point and the code I have is:
[Private Sub Form_Close()
If Me.Text273 = "COMPLETE" Then
DoCmd.OpenQuery "Apps Post Complete", acNormal, acAdd
End If
End Sub]
I have changed this and included a message and it works perfectly up to a point..... I just can't get the form to close if the message is not shown or when it did the message appeared again afterwards.
The new code is:
[Private Sub Command91_Click()
If Me.Text287 = "COMPLETE" Then
Dim myResponse
myResponse = MsgBox("Click Complete Button to update Post Table", vbYesNo, "UPDATE POST TABLE")
If myResponse = vbYes Then
DoCmd.RunMacro "AppsCMPTUpdate"
If myResponse = vbNo Then
DoCmd.Close
Else
DoCmd.Close
End If
End If
End If
End Sub]
Would be grateful of any assistance please.