Open form to current month

C

Chuck W

Hi,
I have a form called frmLineDaysbyMonth that has one field called Month. It
is based on a query called qryLineDaysbyMonth based on a table called
tblLineDays. The query does a distinct on the Month field. I have a subform
called frmLineDays that has three fields: LineDay, PtWithCL and PtWithUCath.
This is based on a query called qryLineDays that is based on the same table
called tblLineDay which has a couple hundred records. The dates are already
filled in for 2009 and 2010. The other two fields are blank. The month field
in this table and query called Month. I set up the frmLineDaysbyMonth so
that users could navigate from one month to another and inside of the form is
the subform that has days of the month as a continuous form. It works fine
except that I want the form to open up to the current month (ie 8/1/09).
Also, it would be nice if the curser would also appear in the field called
PtWithCLfor the current date (8/20/09). This second part would be nice but
not critical. I do need the main form to open to the current month though.
Can someone help?

Thanks,
 
K

KARL DEWEY

Use a query as source for the frmLineDaysbyMonth like this --
SELECT Format([LineDay], "mmmm yyyy") AS MyMonth
FROM tblLineDays
WHERE Format([LineDay], "yyyymm") = Format(Date(), "yyyymm");

Have macro run on from open to GoToControl LineDay, FindRecord - Find What -
Date(). This moves to record matching current date.

Then action GoToControl PtWithCLfor. This moves focus to your field.
 
C

Chuck W

Karl,

Thanks for your help. This worked but I am having a problem. I have a
total of 31 months available. The record navigation arrows for
frmLineDaysbyMonth is on record 12 of 31 and set at August 2009. I can't
scroll to previous months though. The navigation arrows allow me to move from
1 to 31 but the form and subform stay on August 2009. Is there a way to
modify this so that I can scroll to previous months?

Thanks,

KARL DEWEY said:
Use a query as source for the frmLineDaysbyMonth like this --
SELECT Format([LineDay], "mmmm yyyy") AS MyMonth
FROM tblLineDays
WHERE Format([LineDay], "yyyymm") = Format(Date(), "yyyymm");

Have macro run on from open to GoToControl LineDay, FindRecord - Find What -
Date(). This moves to record matching current date.

Then action GoToControl PtWithCLfor. This moves focus to your field.

--
Build a little, test a little.


Chuck W said:
Hi,
I have a form called frmLineDaysbyMonth that has one field called Month. It
is based on a query called qryLineDaysbyMonth based on a table called
tblLineDays. The query does a distinct on the Month field. I have a subform
called frmLineDays that has three fields: LineDay, PtWithCL and PtWithUCath.
This is based on a query called qryLineDays that is based on the same table
called tblLineDay which has a couple hundred records. The dates are already
filled in for 2009 and 2010. The other two fields are blank. The month field
in this table and query called Month. I set up the frmLineDaysbyMonth so
that users could navigate from one month to another and inside of the form is
the subform that has days of the month as a continuous form. It works fine
except that I want the form to open up to the current month (ie 8/1/09).
Also, it would be nice if the curser would also appear in the field called
PtWithCLfor the current date (8/20/09). This second part would be nice but
not critical. I do need the main form to open to the current month though.
Can someone help?

Thanks,
 
K

KARL DEWEY

Remove the WHERE from the query - that will allow all records.
Use the same technique on the main form as for subform to current date.

Have macro run on form open to GoToControl MyMonth, then FindRecord - Find
What - Format(Date(), "mmmm yyyy").

Next GoToControl LineDay, FindRecord - Find What - Date(). This moves to
record matching current date.

Then action GoToControl PtWithCLfor. This moves focus to your field.


--
Build a little, test a little.


Chuck W said:
Karl,

Thanks for your help. This worked but I am having a problem. I have a
total of 31 months available. The record navigation arrows for
frmLineDaysbyMonth is on record 12 of 31 and set at August 2009. I can't
scroll to previous months though. The navigation arrows allow me to move from
1 to 31 but the form and subform stay on August 2009. Is there a way to
modify this so that I can scroll to previous months?

Thanks,

KARL DEWEY said:
Use a query as source for the frmLineDaysbyMonth like this --
SELECT Format([LineDay], "mmmm yyyy") AS MyMonth
FROM tblLineDays
WHERE Format([LineDay], "yyyymm") = Format(Date(), "yyyymm");

Have macro run on from open to GoToControl LineDay, FindRecord - Find What -
Date(). This moves to record matching current date.

Then action GoToControl PtWithCLfor. This moves focus to your field.

--
Build a little, test a little.


Chuck W said:
Hi,
I have a form called frmLineDaysbyMonth that has one field called Month. It
is based on a query called qryLineDaysbyMonth based on a table called
tblLineDays. The query does a distinct on the Month field. I have a subform
called frmLineDays that has three fields: LineDay, PtWithCL and PtWithUCath.
This is based on a query called qryLineDays that is based on the same table
called tblLineDay which has a couple hundred records. The dates are already
filled in for 2009 and 2010. The other two fields are blank. The month field
in this table and query called Month. I set up the frmLineDaysbyMonth so
that users could navigate from one month to another and inside of the form is
the subform that has days of the month as a continuous form. It works fine
except that I want the form to open up to the current month (ie 8/1/09).
Also, it would be nice if the curser would also appear in the field called
PtWithCLfor the current date (8/20/09). This second part would be nice but
not critical. I do need the main form to open to the current month though.
Can someone help?

Thanks,
 

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

Top