dcsimg
Results 1 to 7 of 7

Thread: [RESOLVED] how do i insert to the database according to the selected checkbox

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,528

    Resolved [RESOLVED] how do i insert to the database according to the selected checkbox

    hey,
    i have 7 checkBoxes called chkWorkDays(its an array)

    now each checkbox has name of the week

    e.x
    chkWorkDays(1) = Sunday
    chkWorkDays(2) = Monday
    And so on...

    now i also have a combobox Which contains numbers From 1 to 200(this is the Qty of the times i want to insert to the database the values according to the checkboxes if its checked)

    My question is How do i insert to the database the selected days according to the values of the checkboxes?

    Code:
    E.X 
    i select from the combobox the number 3 (Which is 3 times)
    and i select chkWorkDays(1) which is sunday
    
    so from todays date 
    i need to insert into the database 3 times which the day is sunday(Only sunday)
    
    so today is 13/9/2018 then 
    
    16/9/2018
    23/9/2018
    30/9/2018
    i hope i explained it right
    tnx for any help
    salsa
    Last edited by salsa31; Sep 13th, 2018 at 09:48 AM.

  2. #2

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,528

    Re: how do i insert to the database according to the selected checkbox

    i tried something but its not good
    Code:
    Dim X As Integer
    Dim StrSQL As String
    If chkWorkDays(1).Value = xtpChecked Then
        StrSQL = StrSQL & "#" & Format$(DateAdd("D", X * Val(CmbQty.Text), DtDateNow),  
        "MM\/DD\/yyyy") 
        StrSQL = StrSQL & "#" & Format$(DateAdd("D", X * Val(CmbQty.Text), DtDateNow), 
        "MM\/DD\/yyyy") 
    End If

  3. #3
    Frenzied Member ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    1,231

    Re: how do i insert to the database according to the selected checkbox

    Hi,

    hope it helps...
    Code:
    Private Sub Check1_Click(Index As Integer)
     Dim i As Long, z As Long
       
          For i = 0 To Check1.UBound
             If Check1(i).Value = 1 Then
                z = z + 1
             End If
          Next
          
          MsgBox z
    End Sub
    will return the number 1 etc...

    regards
    Chris
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  4. #4

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,528

    Re: how do i insert to the database according to the selected checkbox

    its not what i am looking for my friend but tnx

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,528

    Re: how do i insert to the database according to the selected checkbox

    i found another way

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,560

    Re: how do i insert to the database according to the selected checkbox

    show us how you did it, and mark this resolved please.

  7. #7

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,528

    Re: how do i insert to the database according to the selected checkbox

    Quote Originally Posted by Lord Orwell View Post
    show us how you did it, and mark this resolved please.
    i just created a combobox with the days name

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width