auto date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 date field which automatically generates the date when the record is
added
one date is in tab strip 1 and other at tab strip 2 both has Now() function
question is
e.g. when I enter records in tab stip 1 the date field gives 26/11/05, two
days later I enter records in tab stip 2 it gives the same date 26/11/05,
I need 28/11/05 to automatically generated in date field of tabstrip 2

help plz

thanks
 
The default value is given to record only when u insert a new. For update the
value of 2 field, u must use
a code vba in event form "beforeupdate" where assigne now() to the field
 
not clear, I need the current date to appear when that specific tab strip is
selected not otherwise

do advise
 
I have 2 date field which automatically generates the date when the record is
added
one date is in tab strip 1 and other at tab strip 2 both has Now() function
question is
e.g. when I enter records in tab stip 1 the date field gives 26/11/05, two
days later I enter records in tab stip 2 it gives the same date 26/11/05,
I need 28/11/05 to automatically generated in date field of tabstrip 2

It sounds like you have *one* date field in your Table, and you're
displaying it in two places on your Form. Don't assume that the
textbox on the Form *contains* the date - it doesn't; it just
*displays* whatever is in that table field. Or, if you have set the
Control Source of the textbox to =Now(), it doesn't store that date
and time anywhere - it just looks at the system clock and displays
whatever it finds.

If you want to have two dates, your table must have two fields. Does
it?

John W. Vinson[MVP]
 
No, I have 2 date field in a table

Both in same form, but in 2 different tab Page under one tab control with
Now function. If today I enter details in tab Page 1 it should give 27/11/05
Tomo. I enter details in tab Page 2 it should give 28/11/05

At the moment both date fields give 27/11/05

plz advise

thanks
 
No, I have 2 date field in a table

Both in same form, but in 2 different tab Page under one tab control with
Now function. If today I enter details in tab Page 1 it should give 27/11/05
Tomo. I enter details in tab Page 2 it should give 28/11/05

Please explain what you mean by "under one tab control with Now
function". Now() returns the current date AND TIME, accurate to a few
microseconds; it does not return the date (though you can use a format
on the field to hide the time portion). And if you are using the
field's Default property, that value is assigned as soon as the record
is created - and the record is *IN THE TABLE*, not on the tab control.

How are you assigning the value to the textbox? What is its
ControlSource? What is its DefaultValue? What (if any) macro or code
are you running?

John W. Vinson[MVP]
 
u r right, date with Now func. will return current date and time every time a
new record is added, since both field is in one table.

for ur q, I have one tab control with 2 Page Index.

now I think its not possible to get the result I am looking. I think I would
need to have different table then try linking it..

thanks for ur time, John appreciate it
 
ok.. in this case wrie vba code in tabstrip click event where u update the
value of 2 field
using:
1.query update
2.recordsetclone
3execute a sql update
The default value is given to record only when u insert a new. For update the
value of 2 field, u must use
a code vba in event form "beforeupdate" where assigne now() to the field
I have 2 date field which automatically generates the date when the record is
added
[quoted text clipped - 7 lines]
 
now I think its not possible to get the result I am looking. I think I would
need to have different table then try linking it..

It is CERTAINLY possible to get what you're asking. The Tab Control's
Change event fires when you select a tab page; each control on that
page has an AfterUpdate which fires when you enter data into the
control. If you have a textbox txtDate2 on the form (doesn't matter
whether it's on the tab page or not), you can use code

Me!txtDate1 = Date

in the approprate event (or use Now to get the date and time).

It's just that the Default property is the wrong tool; it doesn't mean
that there is no tool to do what you want.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top