Msgbox

le888

Registered User.
Local time
Today, 17:17
Joined
Dec 10, 2003
Messages
344
Hi everyone,

How can I refere a record in a msgbox? I explain, let's say ;


Do you wish to Delete " Name of the client # 2 " (record number two) ?

I don't know what to put in the question marks? See below. Does anyone have an idea?

Here are my code:
Code:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click

    Dim response As Integer    
    
    response = MsgBox("Do you wish to Delete  "????"    ?", vbQuestion + vbYesNo)

    If response = vbYes Then
        
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    MsgBox " Record had Deleted"
    End If
    
Exit_cmdDelete_Click:
    Exit Sub

Err_cmdDelete_Click:
    MsgBox Err.Description
    Resume Exit_cmdDelete_Click
    
End Sub

Thanks,

Le
 
MsgBox"Do you wish to Delete " & Me![Name of the client]& " ? " although I would ask why you delete clients?
 
Also, replace:

Code:
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


with

Code:
DoCmd.RunCommand acCmdDeleteRecord
 
Thanks guys.

For Rich, I'm not sure what you are asking.
I have a delete button which is a txtbox control and is in a continuos form. The problem is when I delete let's say the third record but my focus is in the first record it delete the first record and not the third record. So, I have to add a msg to tell the user that if he is deleting the right record. See the attachment. You can see the difference between the delete button and the delete txtbox.

Thanks again,

Le
 
Rich said:
MsgBox"Do you wish to Delete " & Me![Name of the client]& " ? " although I would ask why you delete clients?


Is it possible to highlight or bold only & Me![Name of the client]& this part ?


Thanks,

Le
 
Thanks guys. Short and sweet. You guys are genius.

Le
 
le888 said:
Thanks guys. Short and sweet. You guys are genius.

Le

I have a littlte problem. The "FormattedMsgBox" function is not define.

Le
 
try posting to the thread I pointed you to, as Oldsoftboss created it he might able help you. It just sounds like you need to set the references for the function.

Post the actual action you did for it to cause the error, with a little bit more detail and we should be able to pinpoint the problem.

Andy
 
O.K. I think I was too happy to see this. I forgot to importe the function. I just copy and past the code. So, it is O.K.

Thanks,

Le
 

Users who are viewing this thread

Back
Top Bottom