What I get is this:
DownLoadDate:
05-Aug-04 This is a good date from the text.
30-Dec-99 This is what I get til the next text date is
encountered
30-Dec-99
30-Dec-99
30-Dec-99
-----Original Message-----
Post examples of the values in the field so we can see
what you're
expression is trying to do.
--
Ken Snell
<MS ACCESS MVP>
message
Ok,
I'm getting a date, but it's 30 Dec 99, not the date I
need. Your suggestion has got me a step further.
Thanks
I changed the code as follows:
strDate = Mid$([Field1], 18, 9)
If Len(Field1) > 0 Then
If IsDate(strDate) Then
ResUpDate = [DownLoadDate]
[DownLoadDate] = strDate
ElseIf Not IsDate(strDate) Then
[DownLoadDate] = ResUpDate
End If
-----Original Message-----
First, do not use Date as the name of a field in a
table,
nor as the name of
a control on a form or report. Date is a VBA function
that returns the
current date; when you use it as a field or control
name,
ACCESS can and
usually does become very confused over which one you
mean. In your code,
you're trying to change the value of the Date function
and that will not
work.
Assuming that the rest of the code is ok, for now,
until
you change the name
of the field, your code may work if you change it to
this:
Private Sub SRAN_Enter()
Dim strDate As Variant 'Declares strDate
strDate = Mid$([Field1], 18, 9) 'Gets the string dd
mmm
yyy
If Len(Field1) > 0 Then
If IsDate(strDate) Then
[Date] = strDate
ResUpDate = [Date] 'ResUpDate is a public
procedure
'See below
ElseIf Not IsDate(strDate) Then
[Date] = ResUpDate
End If
If Not IsDate(strDate) Then
[Date] = ResUpDate
End If
End Sub
--
Ken Snell
<MS ACCESS MVP>
message
The "Date" field in the table is a date/time (medium
date). I have about 4500 records and I need the
date to
post to all.
Here is the code.
Thanks for your help.
Mike
Private Sub SRAN_Enter()
Dim strDate As Variant 'Declares strDate
strDate = Mid$([Field1], 18, 9) 'Gets the string dd
mmm
yyy
If Len(Field1) > 0 Then
If IsDate(strDate) Then
Date = strDate
ResUpDate = Date 'ResUpDate is a public
procedure
'See below
ElseIf Not IsDate(strDate) Then
Date = ResUpDate
End If
If Not IsDate(strDate) Then
Date = ResUpDate
End If
End Sub
-------------------------------------------------- ---
---
---
Option Compare Database
Public AutoResDate
Dim ResUpDate As Variant
-----Original Message-----
I think you left out the info you planned to post
re: "fields" etc. Post the
code that you're using and the field / table info.
--
Ken Snell
<MS ACCESS MVP>
"Mike L" <
[email protected]>
wrote in
message
I extract shipping data from a downloaded text
file. I
have no problem getting the date from the header
or
getting the date from the string data. What I
can't
do
is
insert the date in the following fields in the
date
column. I am using an event procedure with code.
any
help would be great.
Thanks,
Mike L
.
.
.