Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unbound controls for Year & Month following Curr Date 1

Status
Not open for further replies.

summer01

Technical User
Jan 28, 2008
19
US
I am fairly new at working with functions and controls and I have looked at so many samples and references, including tec tips,but I cannot seem to make anything work. I have 3 unbound text boxes. One is for current date:date()formatted as short date and it works perfectly. I then have a second and third control where I want the year and month # to populate after the short date is entered.

I know that I will need to use the after update function, and I think that is where I would put Format(Date(),"yyyy") for the year. I tried it on the working control as well s the 2nd control, but it is not working.

Am I going about this the right way, or is there another way I should be doing this? After 3 hours of messing with this I am at a loss. Any help would be appreciated.
 
after the short date is entered
Why would you type the current date ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
When the form is opened, the current Short date automatically populates so the user does not have to make the entry. On a second form that is used to pull reports, I have combo boxes for CSR, Year, Month, and Team, which are all fields on the query that make up some of my reports. I want my user to select the criteria(s) they want and get the correct data. I did convert my entry date on my query but that didn't seem to help so I thought maybe if the year and month fields were on the form and could transfer over to the main table it would work. Hope that makes sense. Just so you can see my query feeding reports, I have shown the sql below:

SELECT qryCsrRpts.Department, qryCsrRpts.[CSR Name], qryCsrRpts.Year, qryCsrRpts.Month, qryCsrRpts.Team, qryCsrRpts.[Type Of Call], qryCsrRpts.[Type Of Work], qryCsrRpts.[Reason For Call], qryCsrRpts.[Line Of Business], qryCsrRpts.[Date Entered], qryCsrRpts.Comments, qryCsrRpts.ResourceUsed
FROM qryCsrRpts
WHERE (((qryCsrRpts.[CSR Name])=[Forms]![frmRptMth]![cboCSR]) AND ((qryCsrRpts.Year)=[Forms]![frmRptMth]![cboYear]) AND ((qryCsrRpts.Month)=[Forms]![frmRptMth]![cboMonth]) AND ((qryCsrRpts.Team)=[Forms]![frmRptMth]![cboTeam]));
 
How are ya summer01 . . .

Have a look at the [blue]Year[/blue] & [blue]Month[/blue] functions!

Also for reference, are the three fields bound?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I have looked at tons of info on the year and month functions and get more mixed up as I look. What I actually had thought about also is using the same technique that I used for my working text box and forget the after update. Following are a couple of the functions I have for Month and Year but by putting them in as the default I get the dates of 6/30/1905 for month and 1/7/1900 for year, so I still think something is missing in these functions.

text box 1: Entry Date, with default of Date().
text box 2: SuppMonth, with a default of Month(Now())
Text box 3: SuppYear, with a default of Year(Now())

Each of the 3 text boxes are tied to the main table . Again text box 1 works great.
 
summer01 . . .

Apparently textboxes 2 & 3 are [blue]date[/blue] data types. [surprise] [blue]Your looking for Integers![/blue] [thumbsup2]

To relieve your confusion, consider that a date is a number. The integer part represents the date, the decimal part the time. This is actually whats in the textbox of a date data type field. [blue]Formatting a date only affects how you view this number![/blue]

So although the [blue]Year[/blue] & [blue]Date[/blue] functions return integers 2008 & 8 respectively, there numbers are a long way from the current date 8/25/2008 which has a value of [blue]39685[/blue].

Since 2 & 3 are bound, you'll have to go back to the table and select integer as the data types. You might also have to reinherit the new data type in the form.

[blue]Your Thoughts? . . .[/blue]



Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Perfect! I don't know why I make things so complex! I changed to integers on the table and it works grand. I kept changing the table from numbers to text to date and back and forth as I was using different samples, so when I came upon this function set up, I had changed back to text.

Thanks for your patience with me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top