Data entry form that opens to today's date

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

Guest

Hi,

I have a table called SalesLog that has records for every business day of
the week. Including the field BusinessDate, there are about 10 other fields
such as NumberCalls, NumberAppointments etc. I then have a form based a
query called SalesLogQuery that is a data entry screen with a row of text
boxes which represent a day. By using the navigation buttons a sales person
can view every business day of the year and enter in the appropriate data.
Right now, the form opens to 1/3/05 which was the first business day of the
year. I want it to open to today's date but I dont want to restrict it to
only showing today's date. Is there a way for the form to open to today's
date but still have all of the other records available in this data entry
form?

Thanks,
 
If you're opening to 12/31/05 then you have records beyond today in the
table. In the OnOpen event I would set focus to the date field, find today,
then set focus to the first field in the tab order. You may want to put some
code in to handle the case where today doesn't exist.
 
Dan,

Thanks for your help. I actually created the table in Excel with records
for every business day of 2005. Sales reps will use this application, and
either every day or once a week, they will fill out how many phone calls they
made, how many appointments that obtained etc. It isn't practical for them
to create the records since they might mess up the date - especially if they
enter information in once a week.

I am a novice access user. Can you give me more details on what you mean?
On the form properties, I clicked the down arrow next to On Open and a list
of macros appeared. I then used the expression builder to find my date field
and selected that to appear in the On Open line but I receive an error
message when I try to open the form. This form is based on a query that is
based on a table which has about 250 records (one for every business day). I
want the form to open to today's date but I dont want it restricted to this
date. Can you help?

Thanks,
 
Chuck,
Next to OnOpen you want the [Event Procedure] selection. Then click on the
button with three dots. This should bring you to a Visual Basic screen where
you'll see:

Private Sub Form_Open(Cancel As Integer)

End Sub

Between the Private Sub and the End Sub add these lines

Me!BusinessDay.SetFocus
DoCmd.FindRecord Date
Me!FirstFieldInTabOrder.SetFocus

replace BusinessDay with the field name for Your date field,
replace FirstFieldInTabOrder with the actual name of the first field.

it should leave you in today's record.
 
Back
Top