PDA

View Full Version : VBA Date problem



GLawes
03-16-2013, 01:41 PM
Hi,
I am new to this forum, and a novice VBA user. And would welcome help with this little problem.

I have two different forms that have a similar date requirement - I would like the current date entered into a field. This should be very simple, in oone form it works fine, in the other form it returns "Runtime Error 438" "object doesn't support this property or method".

The code is absolutely identical in both forms -

Dim dteToday As String

dteToday = Format(Date, "dd/mm/yyyy")
Me.tempDate = dteToday

Anyone have any idea's what I am doing wrong?

Thanks

Doug Robbins
03-16-2013, 06:55 PM
Where the error occurs, is the field 9n the table\query expecting text or a date?

If it's a date field, it won't accept a string.

GLawes
03-17-2013, 02:51 AM
Hi Doug,
Thanks for your response.
In both cases the date field is of "short date" format. I have had no problems feeding text strings to date fields.
However if I rem out the Me.tempDate = dteToday it still returns the error, also if changing the field to a text field.

Very strange!

Gary

dmessimer
03-25-2013, 10:05 AM
I would try setting the filed that you are trying to pass the date into to General date and then try running the code that you have posted.