Warning message

Beany

Registered User.
Local time
Today, 04:26
Joined
Nov 12, 2006
Messages
155
can someone please modify the following code to add a warning message to an add button.................this add button allows to add details filled in a form...


PHP:
 Private Sub addrec_Click()
 Dim strSQL As String
 DoCmd.SetWarnings False
 
 strSQL = "INSERT INTO tab_main ([username], [cost_centre], [number], [phone_model], [imei], [puk_code], [sim_no], [date_issued], [notes], [tariff], [call_int], [roam]) VALUES ('" & Me.username & "','" & Me.cost_centre & "','" & Me.number & "','" & Me.phone_model & "','" & Me.imei & "','" & Me.puk_code & "','" & Me.sim_no & "',#" & Me.date_issued & "#,'" & Me.notes & "','" & Me.tariff & "'," & Me.call_int & "," & Me.roam & ")"
 
 DoCmd.RunSQL strSQL
 DoCmd.SetWarnings True
 End Sub



warning message such as Are you sure you would like to add USERNAME(whateva is inserted in the USERNAME FIELD)


thanks
 
Combine an 'If' statement with a Message Box:

Code:
Dim strmsg
strmsg = "Are you sure you want to add " & username & " to the table?"

If MsgBox(strmsg, vbYesNo) = vbYes Then
    <insert code here>
End If
 
thanks for that....... how do i stop it from adding an empty form?

becoz if i click the add button even if the forms empty, it brings up the message sayin Are you sure you want to add...... etc etc..........

if i click yes, then its adds an empty form!
 

Users who are viewing this thread

Back
Top Bottom