how to connect date picker values to adodb?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Revathi002
    New Member
    • Aug 2012
    • 2

    how to connect date picker values to adodb?

    Code:
    Private Sub Command1_Click()
    Dim EndDate, CurDate As Date
    Dim BusDay, TotBusDays, CalcYear As Integer
    TotBusDays = 1
    CurDate = DTPicker1.Value
    EndDate = DTPicker2.Value
    Do Until CurDate = EndDate
    BusDay = Format(CurDate, "w")
    Select Case BusDay
    Case "2" To "6"
    TotBusDays = TotBusDays + 1
    Case "1"
    'Do nothing
    Case "2"
    'Do nothing
    End Select
    CurDate = DateAdd("d", 1, CurDate)
    Loop
    If Check1.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check2.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check3.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check4.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check5.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check6.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    If Check7.Value = vbChecked Then
    TotBusDays = TotBusDays - 1
    End If
    End Sub
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Sure, and your question is... ¿?

    Check out the Microsoft DAO object library

    Comment

    • Revathi002
      New Member
      • Aug 2012
      • 2

      #3
      how to display the selected values as checked one in calender?

      i have inserted two datepicker in this form and make these values drop in the datebase using adodb connection.Thes e values has to be shown as crossed one in the monthview calendar.How to do this one?
      Code:
      Dim esql As String
      Dim con As New ADODB.Connection
      Dim rs As New ADODB.Recordset
      'show
      Private Sub Command1_Click()
      MonthView1.Value = "8/31/2012"
      MonthView1.MaxSelCount = 7
      MonthView1.SelStart = DTPicker1.Value
      MonthView1.SelEnd = DTPicker2.Value ' here you can put any other date 'like  format(date,"mm-DD-YY") and use datepicker values
      End Sub
      'Add
      Private Sub Command2_Click()
      Adodc1.Recordset.AddNew
      Adodc1.Recordset.Fields(0) = DTPicker1.Value
      Adodc1.Recordset.Fields(1) = DTPicker2.Value
      Adodc1.Recordset.Update
      If Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveNext
      End Sub
      
      Private Sub Form_Load()
      Set con = Nothing
      con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Yogi\Documents\Database1.mdb;Persist Security Info=False"
      Set rs = Nothing
      rs.Open "select * from tmaster", con, adOpenKeyset, adLockPessimistic
      If rs.BOF = True Or rs.EOF = True Then
      Exit Sub
      End If
      Set MSHFlexGrid1.DataSource = rs
      MSHFlexGrid1.Refresh
      End Sub
      .
      Attached Files

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        I'm not sure how this datetime picker works, but i believe it can only cross today's date. Never the less, you can show any date as marked or selected. Check out its properties.

        Comment

        Working...