Re: Data access page and a date field



Contrary to what their name might tell, timestamp fields are not datetime
field and they don't contain a date and time value.

One way to do this would be to make it on the server side by setting the
default value to getdate() - used when the record is created - and to create
a trigger on the update event; for exemple:

CREATE TRIGGER Equipes_DateModification
ON dbo.Equipes
FOR UPDATE
AS
Update E
Set DateModification = getdate()
>From dbo.Equipes E inner join inserted ins on E.IdEquipe = ins.IdEquipe


The default value for the creation date for new records can also be set in a
Insert trigger instead.

If you don't want to act on the server side, then you will have to perfect
your knowledge of javascript.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"John Crerar" <JohnCrerar@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3B432D65-FDE2-4412-911E-E0192B3F5F1F@xxxxxxxxxxxxxxxx
> I'm trying to do pretty much the same thing. I have a DAP which is linked
> to
> a table that has a field timestamp. I want the current date and time to
> automatically populate that field when a record is updated. I tried your
> script, but it doesn't seem to do anything. Does it have to be inserted
> somewhere specific?
>
> "PaulD" wrote:
>
>> "Gr8Gyro" <Gr8Gyro@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:18715096-C017-4BE0-900C-E91CB52537F7@xxxxxxxxxxxxxxxx
>> : Does anyone know if I can default a date field on a data access page to
>> the
>> : current date and have it display the current date on the form when the
>> data
>> : access page is run?
>> : Thanks.
>> :
>> : --
>> : Gyro
>>
>> Is the date field part of the database or just a text box on the DAP?
>> Either way, some VBScript can do the job.
>>
>> <SCRIPT language=vbscript event=DataPageComplete(oEventInfo) for=MSODSC>
>> <!--
>> 'if text box, use something like
>> txtDate.innerText = Date()
>> 'if a field from the database, use something like
>> DateField.value = Date()
>> -->
>> </SCRIPT>
>>
>> Paul D
>>
>>
>>


.