473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting last entry of field for default value in form

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
11 12450
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
2
by: JC Mugs | last post by:
I have a form that when you tab from field to field that the entry point is blank, but if you point and click in the field it brings up a 0 and data entry is started to the left of the zero. ...
6
by: Sameh Ahmed | last post by:
Hello there I need to get the "PwdLastSet" of a user object to know when he last set his password. I am using DirectoryServices.DirectoryEntry to bind to the user object, but it either gives...
1
davydany
by: davydany | last post by:
Hey guys...a n00b Here for this site. I'm making a sequence class for my C++ class. And The thing is in the array that I have, lets say i put in {13,17,38,18}, when i see the current values for the...
4
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.