Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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
 
Old February 26th, 2007, 10:59 AM
Authorized User
 
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default 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

 
Old February 27th, 2007, 08:24 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
 
Old February 27th, 2007, 08:55 AM
Authorized User
 
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default


    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!

 
Old February 27th, 2007, 10:02 AM
Authorized User
 
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default

My main problem is converting the above code to accept input from a text box instead of a DTPicker data box. Any ideas?

 
Old February 27th, 2007, 10:28 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old February 27th, 2007, 12:56 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
 
Old February 28th, 2007, 08:59 AM
Authorized User
 
Join Date: Feb 2007
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to toddw607 Send a message via Yahoo to toddw607
Default

Hi mmcdonal,

After formatting, seperating the three values worked best. Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM
What replaced WinExecCE? cdurbin VB.NET 2002/2003 Basics 0 January 14th, 2004 05:16 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.