 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 26th, 2007, 10:59 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Replaced DTPicker with text box
Hi
I had to replace a DTPicker object with a textbox in Access 2003 but now I am getting an error in a seperate method transferring the date data. Can I still have the date data type still set to Date or would it have to be changed to Long, which is what the fragments of the date ("mm", "dd", "yyyy") are being saved as. Thank you.
-Todd
|
|

February 27th, 2007, 08:24 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What are you doing with the Date data? If you are saving the month number, day number and year number in seperate fields, are you using text for the field, or number? This will determine what variable types you want to use. If you are storing the data as text, then use a String variable, and if as a number, use an Integer variable (since you don't want fractions.)
Did that help?
mmcdonal
|
|

February 27th, 2007, 08:55 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am getting the Date from the user as a text box adn sending it to a GenericReportFunction which is using the CDate function to work with the DTPicker to display a chart. For Example, here is my code:
Select Case LCase(Nz(rstReportFields("ChartType").Value, ""))
Case "pie", "pareto"
intCol = 3
'do nothing
Case Else
dt = CDate(lngFromMonth & "/1/" & lngFromYear)
While dt < DateAdd(strDateInterval, 1, CDate(lngToMonth & "/1/" & lngToYear))
Rng(intRow, intCol).Value = Month(dt) & "/" & Year(dt)
intCol = intCol + 1
'increment to the next month
dt = DateAdd(strDateInterval, 1, dt)
Wend
End Select
Where all the basic variables are a long datatype. Nothing is diaplayed through these reports as they should be. Do I have to change the CDate method in order to do this? Thank you so much for your help!
|
|

February 27th, 2007, 10:02 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My main problem is converting the above code to accept input from a text box instead of a DTPicker data box. Any ideas?
|
|

February 27th, 2007, 10:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Todd,
How is the date stored in your database? Set the input mask on your textbox to ShortDate which is 02/27/2007
You can the compare it directly against the date in your database.
HTH,
Kevin
dartcoach
|
|

February 27th, 2007, 12:56 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Why not three text boxes if you are using this old method. They used to do:
Month Day Year
textbox textbox textbox
Then just take each value after you have done some data validation.
mmcdonal
|
|

February 28th, 2007, 08:59 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi mmcdonal,
After formatting, seperating the three values worked best. Thanks.
|
|
 |