Yes/No Box w/ VBA (1 Viewer)

julia55

Registered User.
Local time
Yesterday, 21:53
Joined
May 2, 2012
Messages
10
I am trying to make a yes/no box in VBA. I have no idea what I am doing in VBA, so please provide a dumbed down explanation. So far I have this saved in a Module, but I can't get it to run. I get an error that says "Compile error: Wrong number of arguments or invalid property assignment." I have pasted my code below. I have searched and searched google and this seems to be what everyone else uses, but it won't work for me. Please help!! :banghead:

Code:
Sub TeamQueryUpdate()
If MsgBox("Have you updated the Team query with new team numbers?", vbQuestion + vbYesNo + vbDefaultbutton6, "Query Update") = vbYes Then
DoCmd.OpenQuery "teamStructure_MakeTable", acViewNormal, acEdit
Else: MsgBox("Update Team query with new team numbers.", vbOKOnly, "Go Update") = Ok
End If
End Sub
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:53
Joined
Feb 19, 2013
Messages
16,618
MsgBox can only return a value and cannot be assigned a value so this line

Else: MsgBox("Update Team query with new team numbers.", vbOKOnly, "Go Update") = Ok

won't work

it would need to be something like

Else If MsgBox("Update Team query with new team numbers.", vbOKOnly, "Go Update") = vbOK then do something
 

Users who are viewing this thread

Top Bottom