Results 1 to 6 of 6

Thread: datepicker problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    30

    datepicker problem

    hello,i have this code
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    
        Me.pump.AddItem "P1--01"
        Me.pump.AddItem "P3--03"
        Me.pump.AddItem "P4--04"
        Me.pump.AddItem "P5--05"
        
        Me.DataGrid.Visible = True
         
    End Sub
    
    Private Sub pump_Click()
    dim dbfilename as stirng
    
    Dim oRs As New ADODB.Recordset
    Dim adoConn As ADODB.Connection
    Set adoConn = New ADODB.Connection
    
     Do
        
            createDummyBase Me.DTP1_date.value, Me.DTP1_hour.value, Me.DTP2_date.value, Me.DTP2_hour.value, 20, pump.Text
            dbFilename = "Report_" & Format(Now, "MM_YY") & ".mdb"
            adoConn.ConnectionString = BuildConnectionString(dbFilename)
            adoConn.Open
            oRs.Open "select * from Report", adoConn, adUseClient, adLockOptimistic
            Set DataGrid.DataSource = oRs
            DataGrid.AllowAddNew = True
            DataGrid.Visible = True
            DataGrid.Refresh
            Debug.Print oRs.RecordCount
    
    End Sub
    in the form load i have one combobox called pump which have four values(P1,P3,P4,P5) and four datepickers , two for selecting the date and two for selecting the hour , called: DTP1_date,DTP1_hour,DTP2_date,DTP2_hour .
    i want when i choose the DTP1_date,DTP1_hour,DTP2_date,DTP2_hour in the form load to pass their values in the createDummyBase sub(not manully with code).
    the .value property of dtpicker doesnot exist.any ideas ?please help.thx

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: datepicker problem

    Initialize then in the form load...

    vb Code:
    1. Private Sub Form_Load()
    2.     With Me.pump
    3.         .AddItem "P1--01"
    4.         .AddItem "P3--03"
    5.         .AddItem "P4--04"
    6.         .AddItem "P5--05"
    7.     End With
    8.    
    9.     DTP1_date.Value = ??? '<~~ Set Default Values Here
    10.     DTP1_hour.Value = ??? '<~~ Set Default Values Here
    11.     DTP2_date.Value = ??? '<~~ Set Default Values Here
    12.     DTP2_hour.Value = ??? '<~~ Set Default Values Here
    13.    
    14.     Me.DataGrid.Visible = True
    15. End Sub

    Also what is createDummyBase sub() ?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    30

    Re: datepicker problem

    Quote Originally Posted by koolsid View Post
    Initialize then in the form load...

    vb Code:
    1. Private Sub Form_Load()
    2.     With Me.pump
    3.         .AddItem "P1--01"
    4.         .AddItem "P3--03"
    5.         .AddItem "P4--04"
    6.         .AddItem "P5--05"
    7.     End With
    8.    
    9.     DTP1_date.Value = ??? '<~~ Set Default Values Here
    10.     DTP1_hour.Value = ??? '<~~ Set Default Values Here
    11.     DTP2_date.Value = ??? '<~~ Set Default Values Here
    12.     DTP2_hour.Value = ??? '<~~ Set Default Values Here
    13.    
    14.     Me.DataGrid.Visible = True
    15. End Sub

    Also what is createDummyBase sub() ?
    as i said the .value property of dtpicker doesnot exist.
    i do not want to pass the value of the datepicker with code but when i chose the date and time from the datepickers in the form load.
    the createdummybase is a sub which creates a .mdb database.
    the createdummybase i want to take the arguments of the selected date and time of the datepickers and from the combobox called pump.how can i do that ?thx

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: datepicker problem

    when i chose the date and time from the datepickers in the form load.
    You mean after form load?

    Before you click the combo do you select the vaues of DTP manually? If not then the value of the DTP will not be passed to createdummybase() correctly...

    You can set the value of the DTP either in the form load or you will have to set the value of DTP manually before clicking the Combo....

    Hope I have understood your query correctly?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: datepicker problem

    as i said the .value property of dtpicker doesnot exist.
    That is odd...!

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    30

    Re: datepicker problem

    Quote Originally Posted by akhileshbc View Post
    That is odd...!
    i havent used the correct control names ..you were right.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width