check mark question on a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • porkchop
    New Member
    • Mar 2008
    • 2

    check mark question on a form

    I have made a check mark box on a form to populate text boxes. (a convience for data entery people, for same data, check mark) This form is viewed as a continuous form, and when we check mark the box, in the next form, the box is allready check marked, I want to prevent/stop that. Help!


    The code:
    Private Sub Check56_Click()
    If Check56.Value = -1 Then
    Me![Generator Name] = Me![Origin Facility]
    Me![Generator Address] = Me![Origin Facility Address]
    Me![Generator City] = Me![Origin Facility City]
    Me![Generator State] = Me![Origin Facility State]
    Me![Generator Zip] = Me![Origin Facility Zip]
    Else
    ' don't copy data.
    Me![Generator Name] = Me![Generator Name]
    Me![Generator Address] = Me![Generator Address]
    Me![Generator City] = Me![Generator City]
    Me![Generator State] = Me![Generator State]
    Me![Generator Zip] = Me![Generator Zip]
    End If
    End Sub

    Thank you.
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi Porkchop. A control on a continuous form is repeated down all rows. As an unbound checkbox will stay checked until you take action to change it back I think you would be better placing a command button on your form instead and linking the code to the command button's on-click event. That way you would not need the IF-THEN-ELSE you currently have.

    By the way, your current IF should just be an IF-THEN. You do not need the ELSE part at all; even if you did, resetting the fields to the values they are already is completely unnecessary.

    Change your checkbox to a command button, label it something like Add Details, and in its on-click event code place the statements that were in your IF:
    [code=vb]Me![Generator Name] = Me![Origin Facility]
    Me![Generator Address] = Me![Origin Facility Address]
    Me![Generator City] = Me![Origin Facility City]
    Me![Generator State] = Me![Origin Facility State]
    Me![Generator Zip] = Me![Origin Facility Zip][/code]
    -Stewart

    Comment

    Working...