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.