MSGBOX yes/no Confirmation

bremensleash

Registered User.
Local time
Tomorrow, 07:12
Joined
Jul 15, 2008
Messages
24
Hello guys

i made a message confirmation box

the problem is that either yes or no the values within my text box are
deleted

guys can you enlighten me with this one

here is my code

If MsgBox("Proceed with the new collection", vbYesNo, "") = vbYes Then
MsgBox "Previous Collection Deleted"
Else


End If
desperately need help:confused:
 
Your code should be correct, what is your problem?
 
Hi,

How are you deleting your data ? because with the code you mentioned all you are doing is simply displaying a message box.
 
Here is the whole code

Code:
Private Sub Command129_Click()

If MsgBox("Proceed with the new collection", vbYesNo, "") = vbYes Then
        MsgBox "Previous Collection Deleted"
    Else
        
        
    End If
    
DateColl1 = ""
DateColl2 = ""
DateColl3 = ""
DateColl4 = ""
DateColl5 = ""
DateColl6 = ""
DateColl7 = ""
DateColl8 = ""
DateColl9 = ""
DateColl10 = ""
TotalC1 = ""
TotalC2 = ""
TotalC3 = ""
TotalC4 = ""
TotalC5 = ""
TotalC6 = ""
TotalC7 = ""
TotalC8 = ""
TotalC9 = ""
TotalC10 = ""
Box_No1 = ""
Box_No2 = ""
Box_No3 = ""
Box_No4 = ""
Box_No5 = ""
Text_166 = ""
Text_168 = ""
Box_No8 = ""
Box_No9 = ""
Box_No10 = ""
Total_Coins = ""
Total_Commsion = ""

End Sub
 
You will want to move all your DateColl1 = "" settings into the IF, obviously currently you get the popup and the code gets to the IF then executes all your empty stuff.

Something like:
If Msgbox = vbyes then
DateColl1 = ""
msgbox "done"
endif
 
Hi,

First of all from the fieldnames it seems that you need to think about redesigning your database, as it seems that your data is not normalized. That apart, your data is being deleted just the same because you placed it outside the if statement, therefore no matter what you click in the message box, your code will still run.

Also, if you want to delete a whole record, you should be setting all your fields empty but rather you can use something like

Code:
DoCmd.RunCommand acCmdDeleteRecord

Hope this helps
 

Users who are viewing this thread

Back
Top Bottom