By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

Getting last entry of field for default value in form

P: n/a
Ok I know this is simple but the statement eludes me...

I have a date field where I want the default value on the data entry form's
date field to be the last date entered. I figure I can do this with a query
but don't know what the criteria needs to be.

Any help would be appreciated,

Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
David,

Put the following code in the AfterUpdate event of the date field on your data
entry form:

Me!NameOfDateField.Default = Me!NameOfDateField
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"David Messner" <dm@thetechtutor.com> wrote in message
news:EM**************@newssvr26.news.prodigy.com.. .
Ok I know this is simple but the statement eludes me...

I have a date field where I want the default value on the data entry form's
date field to be the last date entered. I figure I can do this with a query
but don't know what the criteria needs to be.

Any help would be appreciated,

Thanks

Nov 12 '05 #2

P: n/a
That gives me a error stating...

Run-time error '438':

Object doesn't support this property or method

Code entered is:
Private Sub Date_AfterUpdate()
Me!Date.Default = Me!Date
End Sub

Thanks again for any help,

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:IB******************@newsread1.news.atl.earth link.net...
David,

Put the following code in the AfterUpdate event of the date field on your data entry form:

Me!NameOfDateField.Default = Me!NameOfDateField
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"David Messner" <dm@thetechtutor.com> wrote in message
news:EM**************@newssvr26.news.prodigy.com.. .
Ok I know this is simple but the statement eludes me...

I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this with a query but don't know what the criteria needs to be.

Any help would be appreciated,

Thanks


Nov 12 '05 #3

P: n/a
You are using a reserved word (Date). You should not use them for
naming objects you create. As you can see Access can get confused.

Look at the MSKB article # 109312

- Jim

On Thu, 05 Feb 2004 22:45:22 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
That gives me a error stating...

Run-time error '438':

Object doesn't support this property or method

Code entered is:
Private Sub Date_AfterUpdate()
Me!Date.Default = Me!Date
End Sub

Thanks again for any help,

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:IB******************@newsread1.news.atl.eart hlink.net...
David,

Put the following code in the AfterUpdate event of the date field on your

data
entry form:

Me!NameOfDateField.Default = Me!NameOfDateField
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"David Messner" <dm@thetechtutor.com> wrote in message
news:EM**************@newssvr26.news.prodigy.com.. .
> Ok I know this is simple but the statement eludes me...
>
> I have a date field where I want the default value on the data entryform's > date field to be the last date entered. I figure I can do this with aquery > but don't know what the criteria needs to be.
>
> Any help would be appreciated,
>
> Thanks
>
>




Nov 12 '05 #4

P: n/a
Thanks, that make great sense and I actually know better than that when
using excel.
Changed the names and the same error still comes up but I still DID need the
reminder...boy do I feel daft.

David

"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message
news:40****************@news.west.earthlink.net...
You are using a reserved word (Date). You should not use them for
naming objects you create. As you can see Access can get confused.

Look at the MSKB article # 109312

- Jim

On Thu, 05 Feb 2004 22:45:22 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
That gives me a error stating...

Run-time error '438':

Object doesn't support this property or method

Code entered is:
Private Sub Date_AfterUpdate()
Me!Date.Default = Me!Date
End Sub

Thanks again for any help,

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:IB******************@newsread1.news.atl.eart hlink.net...
David,

Put the following code in the AfterUpdate event of the date field on
yourdata
entry form:

Me!NameOfDateField.Default = Me!NameOfDateField
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"David Messner" <dm@thetechtutor.com> wrote in message
news:EM**************@newssvr26.news.prodigy.com.. .
> Ok I know this is simple but the statement eludes me...
>
> I have a date field where I want the default value on the data entry

form's
> date field to be the last date entered. I figure I can do this with
aquery
> but don't know what the criteria needs to be.
>
> Any help would be appreciated,
>
> Thanks
>
>


Nov 12 '05 #5

P: n/a
You need to use the DefautlValue property - you are using Default.

Private Sub txtTheDate_AfterUpdate()
Me.txtTheDate.DefaultValue = Me.txtTheDate
End Sub

I missed that the first time. :-/

- Jim

On Thu, 05 Feb 2004 23:30:46 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
Thanks, that make great sense and I actually know better than that when
using excel.
Changed the names and the same error still comes up but I still DID need the
reminder...boy do I feel daft.

David

"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message
news:40****************@news.west.earthlink.net.. .
You are using a reserved word (Date). You should not use them for
naming objects you create. As you can see Access can get confused.

Look at the MSKB article # 109312

- Jim

On Thu, 05 Feb 2004 22:45:22 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
>That gives me a error stating...
>
>Run-time error '438':
>
>Object doesn't support this property or method
>
>Code entered is:
>Private Sub Date_AfterUpdate()
> Me!Date.Default = Me!Date
>End Sub
>
>Thanks again for any help,
>
>"PC Datasheet" <sp**@nospam.spam> wrote in message
>news:IB******************@newsread1.news.atl.eart hlink.net...
>> David,
>>
>> Put the following code in the AfterUpdate event of the date field onyour >data
>> entry form:
>>
>> Me!NameOfDateField.Default = Me!NameOfDateField
>>
>>
>> --
>> PC Datasheet
>> Your Resource For Help With Access, Excel And Word Applications
>> re******@pcdatasheet.com
>> www.pcdatasheet.com
>>
>>
>> "David Messner" <dm@thetechtutor.com> wrote in message
>> news:EM**************@newssvr26.news.prodigy.com.. .
>> > Ok I know this is simple but the statement eludes me...
>> >
>> > I have a date field where I want the default value on the data entry
>form's
>> > date field to be the last date entered. I figure I can do this witha >query
>> > but don't know what the criteria needs to be.
>> >
>> > Any help would be appreciated,
>> >
>> > Thanks
>> >
>> >
>>
>>
>
>



Nov 12 '05 #6

P: n/a
Hrmm....

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Me!DailyDate
End Sub

Is what I currently have and the same error is still showing up

Now let me retrace for a second as I was reading the VBA help files and
found that the after update happens after the record is updated and that is
NOT what I am wanting to happen. What I am looking for the DailyDate field
in the Form to have the last date entered automatically.

Let me explain;

I have a data entry form to input "scores" each hour from 8am to 10pm. I
feel it would be a time saver as well as error reducer to have the Date
(DailyDate) field autopopulated with the last date that was entered. So
from 9am to 10pm they don't have to type in the date and can go to the next
field automatically.

Now I usually work with VBA in Excel and Word, but I'm still working on
learning the intricacies of Access.
Nov 12 '05 #7

P: n/a
You might need to coerce the value to a date literal. Try this...

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub
Chr(35) returns #, which is used to identify dates.

AfterUpdate is the right place for the code. Then when you go to new
record the Default Values is what you will see.

- Jim

On Thu, 05 Feb 2004 23:58:56 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
Hrmm....

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Me!DailyDate
End Sub

Is what I currently have and the same error is still showing up

Now let me retrace for a second as I was reading the VBA help files and
found that the after update happens after the record is updated and that is
NOT what I am wanting to happen. What I am looking for the DailyDate field
in the Form to have the last date entered automatically.

Let me explain;

I have a data entry form to input "scores" each hour from 8am to 10pm. I
feel it would be a time saver as well as error reducer to have the Date
(DailyDate) field autopopulated with the last date that was entered. So
from 9am to 10pm they don't have to type in the date and can go to the next
field automatically.

Now I usually work with VBA in Excel and Word, but I'm still working on
learning the intricacies of Access.


Nov 12 '05 #8

P: n/a
Darn, that one sounded good, but still a no go
I have:
Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub

I just noticed that I have not explained how I am getting the error.
After putting in the code and going to a new record the DailyDate field of
the form is blank as it was before I started trying this. But when I type a
date into the field (which is short date formated as is the table) I get the
error mentioned:
Run-time error '438':
Object doesn't support this property or method.

Do I have to have a formating command after the equals for some reason?
"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message
news:40****************@news.west.earthlink.net...
You might need to coerce the value to a date literal. Try this...

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub
Chr(35) returns #, which is used to identify dates.

AfterUpdate is the right place for the code. Then when you go to new
record the Default Values is what you will see.

- Jim

On Thu, 05 Feb 2004 23:58:56 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
Hrmm....

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Me!DailyDate
End Sub

Is what I currently have and the same error is still showing up

Now let me retrace for a second as I was reading the VBA help files and
found that the after update happens after the record is updated and that isNOT what I am wanting to happen. What I am looking for the DailyDate fieldin the Form to have the last date entered automatically.

Let me explain;

I have a data entry form to input "scores" each hour from 8am to 10pm. I
feel it would be a time saver as well as error reducer to have the Date
(DailyDate) field autopopulated with the last date that was entered. So
from 9am to 10pm they don't have to type in the date and can go to the nextfield automatically.

Now I usually work with VBA in Excel and Word, but I'm still working on
learning the intricacies of Access.

Nov 12 '05 #9

P: n/a
David Messner <dm@thetechtutor.com> wrote:
: Darn, that one sounded good, but still a no go
: I have:
: Private Sub Date_AfterUpdate()
: Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
: End Sub
:
: I just noticed that I have not explained how I am getting the error.
: After putting in the code and going to a new record the DailyDate
: field of the form is blank as it was before I started trying this.
: But when I type a date into the field (which is short date formated
: as is the table) I get the error mentioned:
: Run-time error '438':
: Object doesn't support this property or method.
:
: Do I have to have a formating command after the equals for some
: reason?

I have similar code in a database, except I use

Me!DailyDate.DefaultValue = "#" & Me!DailyDate & "#"

in the form's BeforeUpdate event. Works in Access 97 and 2002.

:
:
: "Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in
: message news:40****************@news.west.earthlink.net...
:> You might need to coerce the value to a date literal. Try this...
:>
:> Private Sub Date_AfterUpdate()
:> Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
:> End Sub
:>
:>
:> Chr(35) returns #, which is used to identify dates.
:>
:> AfterUpdate is the right place for the code. Then when you go to new
:> record the Default Values is what you will see.
:>
:> - Jim
:>
:> On Thu, 05 Feb 2004 23:58:56 GMT, "David Messner"
:> <dm@thetechtutor.com> wrote:
:>
:> >Hrmm....
:> >
:> >Private Sub Date_AfterUpdate()
:> > Me!DailyDate.DefaultValue = Me!DailyDate
:> >End Sub
:> >
:> >Is what I currently have and the same error is still showing up
:> >
:> >Now let me retrace for a second as I was reading the VBA help files
:> >and found that the after update happens after the record is updated
:> >and that is NOT what I am wanting to happen. What I am looking for
:> >the DailyDate field in the Form to have the last date entered
:> >automatically.
:> >
:> >Let me explain;
:> >
:> >I have a data entry form to input "scores" each hour from 8am to
:> >10pm. I feel it would be a time saver as well as error reducer to
:> >have the Date (DailyDate) field autopopulated with the last date
:> >that was entered. So from 9am to 10pm they don't have to type in
:> >the date and can go to the next field automatically.
:> >
:> >Now I usually work with VBA in Excel and Word, but I'm still
:> >working on learning the intricacies of Access.

--
http://rec-sport-golf.com/?rc=oinesroald
Please remove the under_scores if sending me mail.
Nov 12 '05 #10

P: n/a
Well, I don't know. I just did a test and it worked fine for me.

Note: You must make an update before the After Update event occurs and
the default value is changed.

As Roald Oines noted in another post it works for him as well.

It's not that difficult, something else must be going on.

- Jim

On Fri, 06 Feb 2004 02:13:50 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
Darn, that one sounded good, but still a no go
I have:
Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub

I just noticed that I have not explained how I am getting the error.
After putting in the code and going to a new record the DailyDate field of
the form is blank as it was before I started trying this. But when I type a
date into the field (which is short date formated as is the table) I get the
error mentioned:
Run-time error '438':
Object doesn't support this property or method.

Do I have to have a formating command after the equals for some reason?
"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message
news:40****************@news.west.earthlink.net.. .
You might need to coerce the value to a date literal. Try this...

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub
Chr(35) returns #, which is used to identify dates.

AfterUpdate is the right place for the code. Then when you go to new
record the Default Values is what you will see.

- Jim

On Thu, 05 Feb 2004 23:58:56 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
>Hrmm....
>
>Private Sub Date_AfterUpdate()
> Me!DailyDate.DefaultValue = Me!DailyDate
>End Sub
>
>Is what I currently have and the same error is still showing up
>
>Now let me retrace for a second as I was reading the VBA help files and
>found that the after update happens after the record is updated and thatis >NOT what I am wanting to happen. What I am looking for the DailyDatefield >in the Form to have the last date entered automatically.
>
>Let me explain;
>
>I have a data entry form to input "scores" each hour from 8am to 10pm. I
>feel it would be a time saver as well as error reducer to have the Date
>(DailyDate) field autopopulated with the last date that was entered. So
>from 9am to 10pm they don't have to type in the date and can go to thenext >field automatically.
>
>Now I usually work with VBA in Excel and Word, but I'm still working on
>learning the intricacies of Access.
>
>



Nov 12 '05 #11

P: n/a
Thanks to both Jim and Roald, I do appreciate the help. Especially all the
patience Jim has shown trying to help me on the 'challenged' night. I do
figure there is something else going on that I'm over looking. I'm going to
start from the beginning and see if I can figure out what I am over looking.
I will post if I do solve it and let you know how I was being a dork this
day.

I do appreciate all the help guys,

David M.

"Jim Allensworth" <Ji****@NOTdatacentricsolutions.com> wrote in message
news:40***************@netnews.comcast.net...
Well, I don't know. I just did a test and it worked fine for me.

Note: You must make an update before the After Update event occurs and
the default value is changed.

As Roald Oines noted in another post it works for him as well.

It's not that difficult, something else must be going on.

- Jim

On Fri, 06 Feb 2004 02:13:50 GMT, "David Messner"
<dm@thetechtutor.com> wrote:
Darn, that one sounded good, but still a no go
I have:
Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub

I just noticed that I have not explained how I am getting the error.
After putting in the code and going to a new record the DailyDate field ofthe form is blank as it was before I started trying this. But when I type adate into the field (which is short date formated as is the table) I get theerror mentioned:
Run-time error '438':
Object doesn't support this property or method.

Do I have to have a formating command after the equals for some reason?
"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message
news:40****************@news.west.earthlink.net.. .
You might need to coerce the value to a date literal. Try this...

Private Sub Date_AfterUpdate()
Me!DailyDate.DefaultValue = Chr(35) & Me!DailyDate & Chr(35)
End Sub
Chr(35) returns #, which is used to identify dates.

AfterUpdate is the right place for the code. Then when you go to new
record the Default Values is what you will see.

- Jim

On Thu, 05 Feb 2004 23:58:56 GMT, "David Messner"
<dm@thetechtutor.com> wrote:

>Hrmm....
>
>Private Sub Date_AfterUpdate()
> Me!DailyDate.DefaultValue = Me!DailyDate
>End Sub
>
>Is what I currently have and the same error is still showing up
>
>Now let me retrace for a second as I was reading the VBA help files and >found that the after update happens after the record is updated and that
is
>NOT what I am wanting to happen. What I am looking for the DailyDate

field
>in the Form to have the last date entered automatically.
>
>Let me explain;
>
>I have a data entry form to input "scores" each hour from 8am to 10pm.

I >feel it would be a time saver as well as error reducer to have the Date >(DailyDate) field autopopulated with the last date that was entered. So >from 9am to 10pm they don't have to type in the date and can go to the

next
>field automatically.
>
>Now I usually work with VBA in Excel and Word, but I'm still working on >learning the intricacies of Access.
>
>


Nov 12 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.