Invalid Use Of Property

Waldin

Registered User.
Local time
Today, 23:41
Joined
Oct 11, 2012
Messages
109
GoodMorning All

My code below is supposed to send automatic emails but it generates the following error "Invalid Use Of Property" when i compile it, how do i get rid of this error...?

Private Sub Form_Timer()
If TimeValue(Now) > CDate("07:00") Then
DoCmd.SendObject
Me.TimerInterval = 0
acSendReport , "WaldinPODetails", _
acFormatPDF, "support@magcc.co.za", , , _
"Reminder Of Parts Not Deleivered", _
"Good Morning, please recieve this reminder to state that the following parts has not been delivered", _
False
End If
End Sub
 
Last edited:
What you have done is put the M.TimeInterval in between the DoCmd.SendObject and its arguments.. Try the following..
Code:
Private Sub Form_Timer()
    If TimeValue(Now) > CDate("07:00") Then
        [COLOR=Blue]Me.TimerInterval = 0[/COLOR]
        [COLOR=Blue]DoCmd.SendObject acSendReport [/COLOR], "WaldinPODetails", _
        acFormatPDF, "support@magcc.co.za", , , _
        "Reminder Of Parts Not Deleivered", _
        "Good Morning, please recieve this reminder to state that the following parts has not been delivered", _
        False
    End If
End Sub
 
Thanks eugin, it worked however now when the automatic email is called up another warning apears saying:

"Track cannot find the object '|1'.

any help with this? im guessing it cannot find a report with the given name right?
 
Which line does it highlight when the error occurs??
Because I do not understand what Track here is..
 
the message doesnt occur when i compile, it occurs in form view when the event is called up but before outlook opens up
 
Okay, my question was when the Error pops up if you click Debug, it will take you to the location which will highlight the line which threw the error..
 
This is the highlighted section

Private Sub Form_Timer()
If TimeValue(Now) > CDate("07:00") Then
Me.TimerInterval = 0
DoCmd.SendObject acSendReport, "WaldinPODetails", _
acFormatPDF, "
support@magcc.co.za", , , _
"Reminder Of Parts Not Deleivered", _
"Good Morning, please recieve this reminder to state that the following parts has not been delivered", _
False

End If
End Sub
 
Is the report that needs to be sent named properly i.e. does it exist, or has it been renamed? Try keeping the report open, and try again..
 
Hi Eugin thanks for the assistance, the report exists and the name is spelled correctly and i cannot seem to find the problem so what ive done is i created a diffrerent code shown below:

Code:

Private Sub Form_Timer()
If TimeValue(Now) > CDate("07:00") Then
DoCmd.SendObject , acFormatPDF, SendReport, "Track2@magcc.co.za", "Track2@magcc.co.za", "", "Parts Not Recieved yet"
Me.TimerInterval = 0
DoCmd.SetWarnings True
End If
End Sub


this code opens outlook with the "to", "cc" and "subject" in its correct fields, the only problem is that i cannot seem to find where to put my attachment, its supposed to be included in the first three arguments but when i include the attachment in the code and compile, it gives the same "Runtime error 2059 Track cannot find the object '|1'."

ive tried everything, i even tried sending a form but it only seems to work without the attachment.

this is the code including the attachment report.

Code:

Private Sub Form_Timer()
If TimeValue(Now) > CDate("07:00") Then
DoCmd.SendObject SendReport, "WaldinPODetails", acFormatPDF, "Track2@magcc.co.za", "Track2@magcc.co.za", "", "Parts Not Recieved yet"
Me.TimerInterval = 0
DoCmd.SetWarnings True
End If
End Sub






 
The code you provided latter does not have the 'ac' before the SendReport.. acSendReport is a constant.. you cannot change it..

The code instructs Access to
Send (DoCmd.SendObject) the Report (acSendReport) object (WaldinPODetails) in a PDF Format (acFormatPDF), to (Track2@magcc.co.za) a CC of (Track2@magcc.co.za) and a BCC (to no one) with a Subject (Parts Not Received yet).. So as you can see it follows a sequence cannot be going any other way.. and constants are to be used as they are.. based on that.. Try the following..
Code:
Private Sub Form_Timer()
    If TimeValue(Now) > CDate("07:00") Then
        DoCmd.SendObject acSendReport, "WaldinPODetails", acFormatPDF, "Track2@magcc.co.za", "Track2@magcc.co.za", "", "Parts Not Recieved yet"
        Me.TimerInterval = 0
        DoCmd.SetWarnings True
    End If
End Sub
 
hi Eugin

no compiling problems but in form view when the event is called up the RunTime error still exists.

im going to explore some other options.

thanks for the contribution.
 

Users who are viewing this thread

Back
Top Bottom