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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a combo box with text to a date? 1

Status
Not open for further replies.

Dophia

Technical User
Jul 26, 2004
263
CA
I have been reading posts, but I can't find an answer to my problem.

I have a form which asks the age of a person.
One field is the number (eg. "1" month or "1" year)
Second field is a combo box which lists "weeks", "months" and "years".

So, you would enter a number in the first field and then chose from the combo box whether the age number is in weeks, months or years.

How can I convert the two fields to a date, which I can use then use as a "date of birth" to calculate their age as of today?

Any help would be appreciated.
Thanks,
Dophia
 
Yes, I did. I can't figure out why this doesn't work. I'll keep trying.
Thanks for your help.
Dophia
 
Why don't you share the SQL of your query QryDOB? It's hard to trouble-shoot what we can't see?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 

Here is the SQL of the QryDOB.

SELECT tblAnimals.Pound_Sheet_No, tblAnimals.Current_Status, tblAnimals.Arrival_Date, tblAnimals.Date_of_birth, tblAnimals.Age_Estimated, tblAnimals.Age_Estimated_Mth_Yr, GetEstAge([Age_Estimated_Mth_Yr],[Age_Estimated]) AS Age1, GetEstDOB([Age_Estimated_Mth_Yr],[age_estimated]) AS Age2
FROM tblAnimals
WHERE (((tblAnimals.Current_Status)="in shelter"));

Although now I get the error: "compile error. in query expression 'GetEstAge([Age_Estimated_Mth_Yr],[Age_Estimated])'.

When I delete this field, I get the same error for the GetEstDOB.

Thanks for your continued help!
Dophia
 
I recopied the code for the 100th time and now it works! I don't know what I did differently.

Thanks for your help and PATIENCE.
Dophia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top