MsgBox actions not working 
Author Message
 MsgBox actions not working

Hi,

I have some code for a message box which I have included
below. My objective with the message box is for the user to
change the 'status' field for the selected record from
'client' to 'closed' when the user clicks on the 'ok'
button in the message box. If the user presses 'cancel'
then the msg box should just close. I can't figure out why,
but the 'status' isn't being changed, though the rest of
the actions in the 'if...then' statement are being done.

Can anyone help?

---

Dim Msg, Style, Title, Response, MyString
Msg="To permanently close this account click OK. Otherwise,
please click Cancel"
Style = vbOKCancel
Title = "Close Account"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
   Status = "Closed"
   Forms!ClientRecords!Title.SetFocus
   DoCmd.GoToRecord acDataForm, "ClientRecords", acNewRec
Else
   Status = "Client"
End If
End Sub

-----

Any help would be appreciated greatly!

Thanks!



Wed, 14 Sep 2005 03:32:39 GMT  
 MsgBox actions not working
What is this line supposed to do: Status = "Closed". Setting the 'Status' field on the form to 'closed'? Then the syntax should be:
Forms!ClientRecords!Status = "Closed"

In your setup Status is a variable (not even declared...) within the sub, which is not used anywhere else in the code. So, you give
a variable a value, but forget to have it displayed on form.

Suggestion: make the status field a checkbox, call it "chkClosed". Is universal, everybody gets it. Your code would become:
Forms!ClientRecords!chkClosed = true

Jacques

Hi,

I have some code for a message box which I have included
below. My objective with the message box is for the user to
change the 'status' field for the selected record from
'client' to 'closed' when the user clicks on the 'ok'
button in the message box. If the user presses 'cancel'
then the msg box should just close. I can't figure out why,
but the 'status' isn't being changed, though the rest of
the actions in the 'if...then' statement are being done.

Can anyone help?

---

Dim Msg, Style, Title, Response, MyString
Msg="To permanently close this account click OK. Otherwise,
please click Cancel"
Style = vbOKCancel
Title = "Close Account"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
   Status = "Closed"
   Forms!ClientRecords!Title.SetFocus
   DoCmd.GoToRecord acDataForm, "ClientRecords", acNewRec
Else
   Status = "Client"
End If
End Sub

-----

Any help would be appreciated greatly!

Thanks!



Wed, 14 Sep 2005 07:24:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Save Action Not working

2. Save action on data control not working

3. @ code msgbox not working

4. Access 97 - Application.Quit does not work if msgbox is displayed

5. Outlook--Msgbox not working...

6. MsgBox not working

7. Aligning text Left or Mid in MsgBox function/action

8. form.action doesn't work!

9. The Form.Action property can't work!!!

10. Action Query (was working?)

11. Getting back the formatted MsgBox in Access 2000 that worked in Access 97

12. Boolean MsgBox doesn't work

 

 
Powered by phpBB® Forum Software