Messages on append and delete... (1 Viewer)

Emma

Registered User.
Local time
Today, 08:42
Joined
May 11, 2000
Messages
37
I have a form that is used as a holding table for records which, once checked, are appended to a final table and then deleted from the holding table. This is done using the following code on a button, which simply runs the append and delete queries. (the queries run on a filter which sorts out the records to be appended/deleted according to whether a check box is completed)

I would like to use my own messages system rather than the default messages that are given when running quereis ("you are about to append" … etc) as with the following code I end up with about 6 messages! However, if I turn of the automatic messages I don’t know if there has been any problems when the queries have run!

My Visual Basic is limited (I am learning slowly from the help of this site!) but what I want to do is say have a message to say “X records were appended successfully” and “x records have been deleted” or give an error message if something goes wrong and gives the user the opportunity to “bail out” if they decide they don’t want to append/delete records.

Am I being to ambitious? Should I just stick with the code and automatic messages? Any comments or suggestions would be very gratefully received.

My code on the command button is:

Private Sub Command53_Click()
On Error GoTo Err_Command53_Click
Dim Msg, Style, Title, Help, Ctxt, Response, MyString

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 ‘saves last record updated
Msg = "Do you want to append the checked records to the main timesheet ?"
Style = vbYesNo + vbExclamation + vbDefaultButton2
Title = "Append checked worked records"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
MyString = "Yes"
DoCmd.OpenQuery "qry_appendcheckedtimesheets", acNormal, acEdit
DoCmd.OpenQuery "qry_deletecheckedtimesheets", acNormal, acEdit
Me.Filter = "[Name] = " & "'" & [Combo65] & "'"
Me.FilterOn = True
MsgBox "Your records have now been appended to the timesheet table" & Chr(13) & " and have been deleted from this table", vbInformation, "Append Complete"
Else
MyString = "No"
End
End If

Exit_Command53_Click:
Exit Sub

Err_Command53_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command53_Click

End Sub

Despite several attempts these messages - I have failed dismally and wonder whether the default messages are there for a reason ....

Many Thanks!

Emma
 

Users who are viewing this thread

Top Bottom