A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combine month and date control results into 1 field



 
 
Thread Tools Display Modes
  #1  
Old October 10th, 2006, 11:10 AM posted to microsoft.public.access.forms
Zilla
external usenet poster
 
Posts: 14
Default Combine month and date control results into 1 field

Hi,

I have a continuous subform detailing attendance, I need each record to be
given a month and year. Currently I'm trying to use a combo for month and one
for year, and I was hoping to somehow combine the two combo results into one
date field on the underlying table (mmmm/yy).

However, as the two combos are unbound, changing either combo on any one
record changes it for all records on the form. I'm not sure how to implement
a solution to this, can some help me out?

Thanks for reading


  #2  
Old October 10th, 2006, 02:05 PM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Combine month and date control results into 1 field

Firstly, a date/time field will always be a full date (with a day, month,
and year), even if you format it so the day is not displayed. You will
therefore need to use something like the first of the month.

You can fudge what you are asking to do in a continuous form, with a couple
of text boxes that have this expression in their Control Source:
=Month([MyDate])
and:
=Year([MyDate])

Now place your two unbound combos behind the 2 text boxes, so the drop-down
arrow of the combo shows to the right of the text box. (In form design, use
Send To Back on the Format menu to place them behind.)

Use the Got Focus event of the text box to SetFocus to the combo. This makes
the combo jump in front of the text box, but Access handles that correctly
so it only appears that way on the current record and the other rows of the
continuous form still show correctly.

Use the GotFocus event of the combo to copy the value from the text box.

Use the AfterUpdate event of the combo to write to the date/time field. The
calculated text boxes will update themselves as the combo disapears behind
the text boxes again.

Set the Tab Stop property of the combos to No, and set the Tab Order
correctly for the text boxes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Zilla" wrote in message
...
Hi,

I have a continuous subform detailing attendance, I need each record to
be
given a month and year. Currently I'm trying to use a combo for month and
one
for year, and I was hoping to somehow combine the two combo results into
one
date field on the underlying table (mmmm/yy).

However, as the two combos are unbound, changing either combo on any one
record changes it for all records on the form. I'm not sure how to
implement
a solution to this, can some help me out?

Thanks for reading



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.