New to VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to set up access to send a confirmation email when ever I
register someone on the database

I have three tables that i want fields displayed in the email:

Attendees [FirstName], [EmailName]
Events [EventName], [StartDate]
Registration [RegistrationFee]

I basically want to say

Dear [FirstName]

I can confirm you have a place on [EventName], [StartDate]. i will contact
you near the time to arrange times and venues.

The outstanding balance of [RegistrationFee] will be invoiced for nearer the
time

Thanks

Phil

I tried to do this originally with a query called Email_query which
generated the data from the a parameter query on the Attendee form this did
not work

i have managed to set up a rudimentarty system using the code

Private Sub Attendee_Registraion_confirm_Click()

DoCmd.SendObject _
, _
, _
, _
[EmailName], _
, _
, _
"Confirmation of registration on Course", _
"Dear " & [AttendeeFirstName] & " " & _
"I can confirm you have a place on:-" & _
" I will contact you near the time to confirm time and
venues," & _
" Thanks Phil", _
True


End Sub

this does not use the query but is a button on the attendee form, i cannot
find a way of entering fields that are not based on the attendee form

can anyone help

thanks

Phil
 
To do this, you must enter the record into a form in your database. You can
then use the AfterInsert event of the form to fire off the email with
SendObject. You will need to learn to write some VBA to achieve this.

How to do that will depend on how your tables are related, and which entry
represents the finalization of the registration. Normally our Registration
table would consist of:
AttendeeID who is attending. Relates to Attendees.AttendeeID
EventID which event. Relates to Events.EventID
RegistrationDate Date/Time. When you entered this registration.

You would then use the AfterInsert event of this table, and you may need to
DLookup() some of the names from the other tables, or you might be able to
read them from the Columns() of the combo boxes.

The end result will be something like this:
strMsg = "Dear " & Me.AttendeeID.Column(2) & vbCrLf & "I ...
DoCmd.SendObject acSendNoObject, , , Me.[EmailName], , , "Registration
accepted", strMsg
 
Back
Top