refreshing a checkbox

Ask a Question related to Microsoft Access, Design and Development.

  1. #1

    Default refreshing a checkbox

    I posted this in a google google group and havent had any
    luck as of yet. Maybe you guys can help me.

    I have a list box that gets it data from a query (we can
    call it listbox1)I also have a checkbox that returns
    information depending on which records are selected in
    Listbox1. When I click on the record in runtime,
    everything runs great, but I need to be able to perform
    this action in code. I am able to selct different records
    in the Listbox1 using Listbox1.Selected(intIndex), but
    when I do this the checkbox is not refreshed. I am
    fairly new to VBA so I am not sure about what code I
    should use to accomplish this. I have already tried to
    use chkRecord.Requery but that doesn't work. Any help
    would be greatly appreciated.

    Thanks in advance,
    Chad

    **The only reply I have gotten from the google group is
    to try chkRecord.Recalc. When I use that it says that
    the object doesn't support that property or method.**
    Chad Guest

  2. Similar Questions and Discussions

    1. .asr pages not refreshing?
      I have a Flash cfform that has ActionScript the includes a "#include 'my_asr_page.asr'" statement. My .asr page works fine with the form, but when I...
    2. Refreshing Templates
      Hi, I'm using Dreamweaver templates (DW8 and Cont. 3) to administer a website. The client requested two new navigation items so I added them to...
    3. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    4. Refreshing, lineto's...
      I have a line, that is being drawn, between two movieclips, with this code Ax = _root.A._x Ay = _root.A._y Bx = _root.B._x By = _root.B._y...
    5. content not refreshing
      I've been doing asp for years but this one stumps me. My pages are not refreshing content. Sometimes they refresh after a minute or two. I've...
  3. #2

    Default Re: refreshing a checkbox

    Wayne,
    THanks a lot for replying to my post I have been having
    many headaches trying to figure out a way to get around
    this. I am not sure that running the event will help too
    much but then again I am not that literate in VBA.
    I have thought of 2 different ways to maybe get around
    this and please let ma know if these are valid, they are
    both similar.

    1. Is there a way to autmate pressing the next record
    button of a record selector. If I was able to do that
    then both the next record in the list box will be
    selected and the Record checkbox will be updated.

    2. Right now, as you know, I am able to go through each
    record for the list box by using
    ListBox1.Selected(intIndex). Is there an equivalant to
    this for a check box, so even though I have to do them
    seperatedly in code I can have the records change in both
    listbox and the check box.

    Thanks again,
    Chad
    >-----Original Message-----
    >You will probably need to tell the check box to have the
    value you want under the
    >conditions set up by your code.
    >
    >Example:
    >Me.chkMyCheckbox = False
    >
    >You are correct, updating through code frequently
    doesn't fire the events that actually
    >clicking on the item will fire. Another possible options
    (it depends on how you have
    >things set up) is to tell the event code to run once you
    have set the items in the listbox
    >through code.
    >
    >Example:
    >listbox1_Click
    >
    >This assumes that the code is on the same form as the
    listbox. If not and this is what you
    >want to do, let me know.
    >
    >--
    >Wayne Morgan
    >Microsoft Access MVP
    >
    >
    >"Chad" <ChadLucy@msn.com> wrote in message
    news:0a6501c34a24$8eba06a0$a501280a@phx.gbl...
    >> I posted this in a google google group and havent had
    any
    >> luck as of yet. Maybe you guys can help me.
    >>
    >> I have a list box that gets it data from a query (we
    can
    >> call it listbox1)I also have a checkbox that returns
    >> information depending on which records are selected in
    >> Listbox1. When I click on the record in runtime,
    >> everything runs great, but I need to be able to perform
    >> this action in code. I am able to selct different
    records
    >> in the Listbox1 using Listbox1.Selected(intIndex), but
    >> when I do this the checkbox is not refreshed. I am
    >> fairly new to VBA so I am not sure about what code I
    >> should use to accomplish this. I have already tried to
    >> use chkRecord.Requery but that doesn't work. Any help
    >> would be greatly appreciated.
    >>
    >> Thanks in advance,
    >> Chad
    >>
    >> **The only reply I have gotten from the google group is
    >> to try chkRecord.Recalc. When I use that it says that
    >> the object doesn't support that property or method.**
    >
    >
    >.
    >
    Chad Guest

  4. #3

    Default Re: refreshing a checkbox

    A check box doesn't have an index number because it doesn't hold multiple values at one
    time, it is either True or False. If it is set for Triple State then add Null to the
    possible list. Simply setting the value of the checkbox is how you would set it. Now, if
    you name your checkboxes sequentially, you can use a loop to go through them.

    Example:
    chkCheckbox1, chkCheckbox2

    For i = 1 to 2
    Me.Controls("chkCheckbox" & i) = False
    Next i


    Yes, you can move from one record to another in code.

    Example:
    If Not Me.Recordset.EOF Then
    Me.Recordset.MoveNext
    End If

    EOF stands for End Of File, you don't want to move to the next record if you're at the
    end.

    --
    Wayne Morgan
    Microsoft Access MVP


    "Chad" <ChadLucy@msn.com> wrote in message news:04e301c34a7b$57700da0$a601280a@phx.gbl...
    > Wayne,
    > THanks a lot for replying to my post I have been having
    > many headaches trying to figure out a way to get around
    > this. I am not sure that running the event will help too
    > much but then again I am not that literate in VBA.
    > I have thought of 2 different ways to maybe get around
    > this and please let ma know if these are valid, they are
    > both similar.
    >
    > 1. Is there a way to autmate pressing the next record
    > button of a record selector. If I was able to do that
    > then both the next record in the list box will be
    > selected and the Record checkbox will be updated.
    >
    > 2. Right now, as you know, I am able to go through each
    > record for the list box by using
    > ListBox1.Selected(intIndex). Is there an equivalant to
    > this for a check box, so even though I have to do them
    > seperatedly in code I can have the records change in both
    > listbox and the check box.
    >
    > Thanks again,
    > Chad
    > >-----Original Message-----
    > >You will probably need to tell the check box to have the
    > value you want under the
    > >conditions set up by your code.
    > >
    > >Example:
    > >Me.chkMyCheckbox = False
    > >
    > >You are correct, updating through code frequently
    > doesn't fire the events that actually
    > >clicking on the item will fire. Another possible options
    > (it depends on how you have
    > >things set up) is to tell the event code to run once you
    > have set the items in the listbox
    > >through code.
    > >
    > >Example:
    > >listbox1_Click
    > >
    > >This assumes that the code is on the same form as the
    > listbox. If not and this is what you
    > >want to do, let me know.
    > >
    > >--
    > >Wayne Morgan
    > >Microsoft Access MVP
    > >
    > >
    > >"Chad" <ChadLucy@msn.com> wrote in message
    > news:0a6501c34a24$8eba06a0$a501280a@phx.gbl...
    > >> I posted this in a google google group and havent had
    > any
    > >> luck as of yet. Maybe you guys can help me.
    > >>
    > >> I have a list box that gets it data from a query (we
    > can
    > >> call it listbox1)I also have a checkbox that returns
    > >> information depending on which records are selected in
    > >> Listbox1. When I click on the record in runtime,
    > >> everything runs great, but I need to be able to perform
    > >> this action in code. I am able to selct different
    > records
    > >> in the Listbox1 using Listbox1.Selected(intIndex), but
    > >> when I do this the checkbox is not refreshed. I am
    > >> fairly new to VBA so I am not sure about what code I
    > >> should use to accomplish this. I have already tried to
    > >> use chkRecord.Requery but that doesn't work. Any help
    > >> would be greatly appreciated.
    > >>
    > >> Thanks in advance,
    > >> Chad
    > >>
    > >> **The only reply I have gotten from the google group is
    > >> to try chkRecord.Recalc. When I use that it says that
    > >> the object doesn't support that property or method.**
    > >
    > >
    > >.
    > >

    Wayne Morgan Guest

  5. #4

    Default Re: refreshing a checkbox

    Wayne,
    THanks for your help. Moving to the next record does
    exactly what I needed.
    Chad
    >-----Original Message-----
    >A check box doesn't have an index number because it
    doesn't hold multiple values at one
    >time, it is either True or False. If it is set for
    Triple State then add Null to the
    >possible list. Simply setting the value of the checkbox
    is how you would set it. Now, if
    >you name your checkboxes sequentially, you can use a
    loop to go through them.
    >
    >Example:
    >chkCheckbox1, chkCheckbox2
    >
    >For i = 1 to 2
    > Me.Controls("chkCheckbox" & i) = False
    >Next i
    >
    >
    >Yes, you can move from one record to another in code.
    >
    >Example:
    >If Not Me.Recordset.EOF Then
    > Me.Recordset.MoveNext
    >End If
    >
    >EOF stands for End Of File, you don't want to move to
    the next record if you're at the
    >end.
    >
    >--
    >Wayne Morgan
    >Microsoft Access MVP
    >
    >
    >"Chad" <ChadLucy@msn.com> wrote in message
    news:04e301c34a7b$57700da0$a601280a@phx.gbl...
    >> Wayne,
    >> THanks a lot for replying to my post I have been
    having
    >> many headaches trying to figure out a way to get around
    >> this. I am not sure that running the event will help
    too
    >> much but then again I am not that literate in VBA.
    >> I have thought of 2 different ways to maybe get around
    >> this and please let ma know if these are valid, they
    are
    >> both similar.
    >>
    >> 1. Is there a way to autmate pressing the next record
    >> button of a record selector. If I was able to do that
    >> then both the next record in the list box will be
    >> selected and the Record checkbox will be updated.
    >>
    >> 2. Right now, as you know, I am able to go through
    each
    >> record for the list box by using
    >> ListBox1.Selected(intIndex). Is there an equivalant to
    >> this for a check box, so even though I have to do them
    >> seperatedly in code I can have the records change in
    both
    >> listbox and the check box.
    >>
    >> Thanks again,
    >> Chad
    >> >-----Original Message-----
    >> >You will probably need to tell the check box to have
    the
    >> value you want under the
    >> >conditions set up by your code.
    >> >
    >> >Example:
    >> >Me.chkMyCheckbox = False
    >> >
    >> >You are correct, updating through code frequently
    >> doesn't fire the events that actually
    >> >clicking on the item will fire. Another possible
    options
    >> (it depends on how you have
    >> >things set up) is to tell the event code to run once
    you
    >> have set the items in the listbox
    >> >through code.
    >> >
    >> >Example:
    >> >listbox1_Click
    >> >
    >> >This assumes that the code is on the same form as the
    >> listbox. If not and this is what you
    >> >want to do, let me know.
    >> >
    >> >--
    >> >Wayne Morgan
    >> >Microsoft Access MVP
    >> >
    >> >
    >> >"Chad" <ChadLucy@msn.com> wrote in message
    >> news:0a6501c34a24$8eba06a0$a501280a@phx.gbl...
    >> >> I posted this in a google google group and havent
    had
    >> any
    >> >> luck as of yet. Maybe you guys can help me.
    >> >>
    >> >> I have a list box that gets it data from a query (we
    >> can
    >> >> call it listbox1)I also have a checkbox that returns
    >> >> information depending on which records are selected
    in
    >> >> Listbox1. When I click on the record in runtime,
    >> >> everything runs great, but I need to be able to
    perform
    >> >> this action in code. I am able to selct different
    >> records
    >> >> in the Listbox1 using Listbox1.Selected(intIndex),
    but
    >> >> when I do this the checkbox is not refreshed. I am
    >> >> fairly new to VBA so I am not sure about what code I
    >> >> should use to accomplish this. I have already
    tried to
    >> >> use chkRecord.Requery but that doesn't work. Any
    help
    >> >> would be greatly appreciated.
    >> >>
    >> >> Thanks in advance,
    >> >> Chad
    >> >>
    >> >> **The only reply I have gotten from the google
    group is
    >> >> to try chkRecord.Recalc. When I use that it says
    that
    >> >> the object doesn't support that property or
    method.**
    >> >
    >> >
    >> >.
    >> >
    >
    >
    >.
    >
    Chad Guest

  6. #5

    Default Re: refreshing a checkbox

    Wayne,
    I promise this is my last question for you. Thank you
    for your patience. In moving to the next record with the
    code Me.Recordset.MoveNext, how would I switch Me to the
    name of the form that I am using. I tried
    Forms!frmResults!subfrmSCResults.Recordsset.MoveNe xt but
    it ways that the object doesnt support that property or
    method. The reason I am asking is because I was thinking
    about putting the code in a seperate module and calling
    on it when I needed it.

    THanks again.
    Chad
    >-----Original Message-----
    >A check box doesn't have an index number because it
    doesn't hold multiple values at one
    >time, it is either True or False. If it is set for
    Triple State then add Null to the
    >possible list. Simply setting the value of the checkbox
    is how you would set it. Now, if
    >you name your checkboxes sequentially, you can use a
    loop to go through them.
    >
    >Example:
    >chkCheckbox1, chkCheckbox2
    >
    >For i = 1 to 2
    > Me.Controls("chkCheckbox" & i) = False
    >Next i
    >
    >
    >Yes, you can move from one record to another in code.
    >
    >Example:
    >If Not Me.Recordset.EOF Then
    > Me.Recordset.MoveNext
    >End If
    >
    >EOF stands for End Of File, you don't want to move to
    the next record if you're at the
    >end.
    >
    >--
    >Wayne Morgan
    >Microsoft Access MVP
    >
    >
    >"Chad" <ChadLucy@msn.com> wrote in message
    news:04e301c34a7b$57700da0$a601280a@phx.gbl...
    >> Wayne,
    >> THanks a lot for replying to my post I have been
    having
    >> many headaches trying to figure out a way to get around
    >> this. I am not sure that running the event will help
    too
    >> much but then again I am not that literate in VBA.
    >> I have thought of 2 different ways to maybe get around
    >> this and please let ma know if these are valid, they
    are
    >> both similar.
    >>
    >> 1. Is there a way to autmate pressing the next record
    >> button of a record selector. If I was able to do that
    >> then both the next record in the list box will be
    >> selected and the Record checkbox will be updated.
    >>
    >> 2. Right now, as you know, I am able to go through
    each
    >> record for the list box by using
    >> ListBox1.Selected(intIndex). Is there an equivalant to
    >> this for a check box, so even though I have to do them
    >> seperatedly in code I can have the records change in
    both
    >> listbox and the check box.
    >>
    >> Thanks again,
    >> Chad
    >> >-----Original Message-----
    >> >You will probably need to tell the check box to have
    the
    >> value you want under the
    >> >conditions set up by your code.
    >> >
    >> >Example:
    >> >Me.chkMyCheckbox = False
    >> >
    >> >You are correct, updating through code frequently
    >> doesn't fire the events that actually
    >> >clicking on the item will fire. Another possible
    options
    >> (it depends on how you have
    >> >things set up) is to tell the event code to run once
    you
    >> have set the items in the listbox
    >> >through code.
    >> >
    >> >Example:
    >> >listbox1_Click
    >> >
    >> >This assumes that the code is on the same form as the
    >> listbox. If not and this is what you
    >> >want to do, let me know.
    >> >
    >> >--
    >> >Wayne Morgan
    >> >Microsoft Access MVP
    >> >
    >> >
    >> >"Chad" <ChadLucy@msn.com> wrote in message
    >> news:0a6501c34a24$8eba06a0$a501280a@phx.gbl...
    >> >> I posted this in a google google group and havent
    had
    >> any
    >> >> luck as of yet. Maybe you guys can help me.
    >> >>
    >> >> I have a list box that gets it data from a query (we
    >> can
    >> >> call it listbox1)I also have a checkbox that returns
    >> >> information depending on which records are selected
    in
    >> >> Listbox1. When I click on the record in runtime,
    >> >> everything runs great, but I need to be able to
    perform
    >> >> this action in code. I am able to selct different
    >> records
    >> >> in the Listbox1 using Listbox1.Selected(intIndex),
    but
    >> >> when I do this the checkbox is not refreshed. I am
    >> >> fairly new to VBA so I am not sure about what code I
    >> >> should use to accomplish this. I have already
    tried to
    >> >> use chkRecord.Requery but that doesn't work. Any
    help
    >> >> would be greatly appreciated.
    >> >>
    >> >> Thanks in advance,
    >> >> Chad
    >> >>
    >> >> **The only reply I have gotten from the google
    group is
    >> >> to try chkRecord.Recalc. When I use that it says
    that
    >> >> the object doesn't support that property or
    method.**
    >> >
    >> >
    >> >.
    >> >
    >
    >
    >.
    >
    Chad Guest

  7. #6

    Default Re: refreshing a checkbox

    Me is shorthand for the form that the code is running on. To refer to another form you
    need to use, as you indicated, Forms!FormName. To refer to a subform on a form, you need
    to refer to the control on the main form that holds the subform.

    Example:
    Forms!frmResults!NameOfSubformControl.Form.Records et.MoveNext
    (you also had a typo, only one "s" in recordset)

    If the form running the code is frmResults you could shorten the above:
    Me!NameOfSubformControl.Form.Recordset.MoveNext

    To get the name of the subform control, open the main form in design mode. Open the
    Properties sheet if it isn't already. Click on the subform ONE time. The Properties sheet
    should show the name of the subform control. If you click twice, you'll be in the subform
    and the Properties sheet will show the name of the form, not the control holding it.

    --
    Wayne Morgan
    Microsoft Access MVP


    "Chad" <ChadLucy@msn.com> wrote in message news:0c9201c34ade$436e8ee0$a401280a@phx.gbl...
    > Wayne,
    > I promise this is my last question for you. Thank you
    > for your patience. In moving to the next record with the
    > code Me.Recordset.MoveNext, how would I switch Me to the
    > name of the form that I am using. I tried
    > Forms!frmResults!subfrmSCResults.Recordsset.MoveNe xt but
    > it ways that the object doesnt support that property or
    > method. The reason I am asking is because I was thinking
    > about putting the code in a seperate module and calling
    > on it when I needed it.

    Wayne Morgan Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139