Runtime Error 438

nomax

Registered User.
Local time
Today, 11:05
Joined
Dec 20, 2015
Messages
21
Good morning all,

I'm stumped, pretty sure I know what the issue is, but I'm not certain on how to fix it and know that someone on this forum will be able to tell me what I'm doing wrong.

Here is the code I am using:

stbody = ("Thank you for allowing us the opportunity to assist you with your travel plans. Below please find the details you requested!" & vbCrLf & vbCrLf & _
"Destination: " & Me!Destination & vbCrLf & vbCrLf & _
"Primary Guest: " & Me!Guest1 & vbCrLf & vbCrLf & _
"Departure Date: " & Me!Departuredate & vbCrLf & vbCrLf & _
"Flight Details: " & Me!FlightDetails)

My problem line is Departure Date - if I remove this line, no error - I'm sure that this has something to do with that this line is numeric, but I'm clueless on how to fix it.

Any help would be greatly appreciated.

Thank you
 
Maybe the CStr function could help.
Code:
"Departure Date: " & CStr(Me!Departuredate) & vbCrLf & vbCrLf & _
 
Thanks, but nope that didn't help - same error
 
have you tried using a dot rather than a bang? Me.Departuredate
normally i dont think it would make much of a difference but sometimes the access gnomes do.
 
Nope that didn't work either, I think it has something to do with this is a numeric field - i've removed the field and it works, I've added a different numeric field and the same error
 
have you checked your spelling? I noticed in one of your other posts you have [Departure Date]
 
Yes, now I have and even a different numeric field is causing the same issue
 
Error 438 is "Object doesn't support this property or method." Offhand, I don't really see why this should fail because the syntax looks OK but of course I can't tell the formats of the data fields, which could have a bearing on the error. You have a superfluous parenthesis at each end of the statement, but they are properly balanced so that isn't an issue.

So... what is each field defined to be? You say you suspect numeric fields. So how do you define DepartureDate in your table? How is it input? Show us a sample of that field. It looks like a control on a form, so moke's and JHB's suggestions are relevant. For numeric fields, normally you might need a CSTR function to convert them to strings, but that should be all that is needed.

Here is a suggestion. STRICTLY FOR DEBUGGING, change your code to look like this:

Code:
stbody = "Thank you for allowing us the opportunity to assist you with your travel plans. Below please find the details you requested!" & vbCrLf & vbCrLf
stbody = stbody & "Destination: " & Me!Destination & vbCrLf & vbCrLf
stbody = stbody & "Primary Guest: " & Me!Guest1 & vbCrLf & vbCrLf
stbody = stbody & "Departure Date: " & Me!Departuredate & vbCrLf & vbCrLf
stbody = stbody & "Flight Details: " & Me!FlightDetails

You said you THOUGHT the error was with departure date. Doing this debugging line split will confirm exactly which element is giving you fits. However, it also will give you the chance to respond to a debug message box where you can choose to debug the code at that point. So debug it, see which line is highlighted in the code. Open the immediate window. Do a Debug.Print on the only data field in that line that ISN'T a quoted constant - e.g. the Me!Departuredate reference - to see what Access tells you.

This is just a bit tedious to do - but the goal is to divide and conquer the bug by breaking the components down to individually separated parts so that you can confirm what is wrong - and which one is wrong.
 
Okay, Doc Man - replaced it exactly as you noted and still come up with the runtime error on that line
stbody = "Thank you for allowing us the opportunity to assist you with your travel plans. Below please find the details you requested!" & vbCrLf & vbCrLf
stbody = stbody & "Destination: " & Me!Destination & vbCrLf & vbCrLf
stbody = stbody & "Primary Guest: " & Me!Guest1 & vbCrLf & vbCrLf
stbody = stbody & "Departure Date: " & Me!Departuredate & vbCrLf & vbCrLf
stbody = stbody & "Flight Details: " & Me!FlightDetails

It highlighted that line. Maybe I will try and delting the line from my table and readding
 
Must have been something funky in the line, deleting the line, changing the name to just departure and readded - now it works!!!!
 

Users who are viewing this thread

Back
Top Bottom