Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Form verification coding question

Discussion in 'Information Technology' started by Al, Jul 28, 2006.

  1. Al

    Al
    Expand Collapse
    Guest

    I would like to put in a verification check in a form, however I can't
    seem to figure out how to get it to work.

    I have a field entitled "PaymentType" and a field entitled
    "CheckNumber".
    PaymentType is a drop-down list.
    One of the PaymentType options is "Check".
    I would like to make it such that if the user selects the PaymentType
    of "Check" the form requires the user to input a CheckNumber.

    I've played around with IIF statments, but they don't seem to be
    working right.

    Help? Please?
     
  2. Loading...


  3. Jeff Boyce

    Jeff Boyce
    Expand Collapse
    Guest

    One approach would be to add code to the form's BeforeUpdate event that does
    the verification. You could use an If() function for this.

    Given that you/Access probably wouldn't "know" until after the user
    attempted to save the record, this might be your best approach.

    Note, however, that you could leave the CheckNumber textbox greyed-out
    (Enabled = False), and turn it "on" only if the "Check" option is selected
    (and turn it back off if another option is chosen).

    Regards

    Jeff Boyce
    Microsoft Office/Access MVP


    "Al" <thealanberman@gmail.com> wrote in message
    news:1150148403.963175.115110@i40g2000cwc.googlegroups.com...
    >I would like to put in a verification check in a form, however I can't
    > seem to figure out how to get it to work.
    >
    > I have a field entitled "PaymentType" and a field entitled
    > "CheckNumber".
    > PaymentType is a drop-down list.
    > One of the PaymentType options is "Check".
    > I would like to make it such that if the user selects the PaymentType
    > of "Check" the form requires the user to input a CheckNumber.
    >
    > I've played around with IIF statments, but they don't seem to be
    > working right.
    >
    > Help? Please?
    >
     
  4. Thanks for the help, Jeff.

    I was hoping you'd be able to offer a more detailed description of how
    to do this. We've tried functions like
    IIf([PaymentType]="Check",[CheckNumber].Visible, null) after setting
    the CheckNumber field to disabled, but we're both rather new to Access
    and nothing we come up with yields useful results.

    Can you offer any more assistance or more detailed instructions?

    Thanks,
    Katherine

    Jeff Boyce wrote:
    > One approach would be to add code to the form's BeforeUpdate event that does
    > the verification. You could use an If() function for this.
    >
    > Given that you/Access probably wouldn't "know" until after the user
    > attempted to save the record, this might be your best approach.
    >
    > Note, however, that you could leave the CheckNumber textbox greyed-out
    > (Enabled = False), and turn it "on" only if the "Check" option is selected
    > (and turn it back off if another option is chosen).
    >
    > Regards
    >
    > Jeff Boyce
    > Microsoft Office/Access MVP
    >
    >
    > "Al" <thealanberman@gmail.com> wrote in message
    > news:1150148403.963175.115110@i40g2000cwc.googlegroups.com...
    > >I would like to put in a verification check in a form, however I can't
    > > seem to figure out how to get it to work.
    > >
    > > I have a field entitled "PaymentType" and a field entitled
    > > "CheckNumber".
    > > PaymentType is a drop-down list.
    > > One of the PaymentType options is "Check".
    > > I would like to make it such that if the user selects the PaymentType
    > > of "Check" the form requires the user to input a CheckNumber.
    > >
    > > I've played around with IIF statments, but they don't seem to be
    > > working right.
    > >
    > > Help? Please?
    > >
     
  5. Thanks for the help, Jeff.

    I was hoping you'd be able to offer a more detailed description of how
    to do this. We've tried functions like
    IIf([PaymentType]="Check",[CheckNumber].Visible, null) after setting
    the CheckNumber field to disabled, but we're both rather new to Access
    and nothing we come up with yields useful results.

    Can you offer any more assistance or more detailed instructions?

    Thanks,
    Katherine

    Jeff Boyce wrote:
    > One approach would be to add code to the form's BeforeUpdate event that does
    > the verification. You could use an If() function for this.
    >
    > Given that you/Access probably wouldn't "know" until after the user
    > attempted to save the record, this might be your best approach.
    >
    > Note, however, that you could leave the CheckNumber textbox greyed-out
    > (Enabled = False), and turn it "on" only if the "Check" option is selected
    > (and turn it back off if another option is chosen).
    >
    > Regards
    >
    > Jeff Boyce
    > Microsoft Office/Access MVP
    >
    >
    > "Al" <thealanberman@gmail.com> wrote in message
    > news:1150148403.963175.115110@i40g2000cwc.googlegroups.com...
    > >I would like to put in a verification check in a form, however I can't
    > > seem to figure out how to get it to work.
    > >
    > > I have a field entitled "PaymentType" and a field entitled
    > > "CheckNumber".
    > > PaymentType is a drop-down list.
    > > One of the PaymentType options is "Check".
    > > I would like to make it such that if the user selects the PaymentType
    > > of "Check" the form requires the user to input a CheckNumber.
    > >
    > > I've played around with IIF statments, but they don't seem to be
    > > working right.
    > >
    > > Help? Please?
    > >
     
  6. Katherine

    Katherine
    Expand Collapse
    Guest

    Thanks for the help, Jeff.

    I was hoping you'd be able to offer a more detailed description of how
    to do this. We've tried functions like
    IIf([PaymentType]="Check",[CheckNumber].Visible, null) after setting
    the CheckNumber field to disabled, but we're both rather new to Access
    and nothing we come up with yields useful results.

    Can you offer any more assistance or more detailed instructions?

    Thanks,
    Katherine

    Jeff Boyce wrote:
    > One approach would be to add code to the form's BeforeUpdate event that does
    > the verification. You could use an If() function for this.
    >
    > Given that you/Access probably wouldn't "know" until after the user
    > attempted to save the record, this might be your best approach.
    >
    > Note, however, that you could leave the CheckNumber textbox greyed-out
    > (Enabled = False), and turn it "on" only if the "Check" option is selected
    > (and turn it back off if another option is chosen).
    >
    > Regards
    >
    > Jeff Boyce
    > Microsoft Office/Access MVP
    >
    >
    > "Al" <thealanberman@gmail.com> wrote in message
    > news:1150148403.963175.115110@i40g2000cwc.googlegroups.com...
    > >I would like to put in a verification check in a form, however I can't
    > > seem to figure out how to get it to work.
    > >
    > > I have a field entitled "PaymentType" and a field entitled
    > > "CheckNumber".
    > > PaymentType is a drop-down list.
    > > One of the PaymentType options is "Check".
    > > I would like to make it such that if the user selects the PaymentType
    > > of "Check" the form requires the user to input a CheckNumber.
    > >
    > > I've played around with IIF statments, but they don't seem to be
    > > working right.
    > >
    > > Help? Please?
    > >
     
  7. Jeff Boyce

    Jeff Boyce
    Expand Collapse
    Guest

    Take a look in Access HELP for specific syntax on commands.

    You'll need to understand how to use VBA in form events (the BeforeUpdate
    event) to make it work for you.

    Your code might look something like (actual syntax may vary):

    If Me.PaymentType = "Check" Then
    Me.CheckNumber.Enabled = True
    Else
    Me.CheckNumber.Enabled = False
    End If

    or a more-abbreviated version:

    Me.CheckNumber.Enabled = (Me.PaymentType = "Check")

    This assumes that the actual value of the control you call [PaymentType] is
    "Check" and not an ID number...

    Good luck!

    Jeff Boyce
    Microsoft Office/Access MVP


    <OatBoatBaBoatBoatMcBoatNut.Nog@gmail.com> wrote in message
    news:1150216472.208580.320100@f6g2000cwb.googlegroups.com...
    > Thanks for the help, Jeff.
    >
    > I was hoping you'd be able to offer a more detailed description of how
    > to do this. We've tried functions like
    > IIf([PaymentType]="Check",[CheckNumber].Visible, null) after setting
    > the CheckNumber field to disabled, but we're both rather new to Access
    > and nothing we come up with yields useful results.
    >
    > Can you offer any more assistance or more detailed instructions?
    >
    > Thanks,
    > Katherine
    >
    > Jeff Boyce wrote:
    >> One approach would be to add code to the form's BeforeUpdate event that
    >> does
    >> the verification. You could use an If() function for this.
    >>
    >> Given that you/Access probably wouldn't "know" until after the user
    >> attempted to save the record, this might be your best approach.
    >>
    >> Note, however, that you could leave the CheckNumber textbox greyed-out
    >> (Enabled = False), and turn it "on" only if the "Check" option is
    >> selected
    >> (and turn it back off if another option is chosen).
    >>
    >> Regards
    >>
    >> Jeff Boyce
    >> Microsoft Office/Access MVP
    >>
    >>
    >> "Al" <thealanberman@gmail.com> wrote in message
    >> news:1150148403.963175.115110@i40g2000cwc.googlegroups.com...
    >> >I would like to put in a verification check in a form, however I can't
    >> > seem to figure out how to get it to work.
    >> >
    >> > I have a field entitled "PaymentType" and a field entitled
    >> > "CheckNumber".
    >> > PaymentType is a drop-down list.
    >> > One of the PaymentType options is "Check".
    >> > I would like to make it such that if the user selects the PaymentType
    >> > of "Check" the form requires the user to input a CheckNumber.
    >> >
    >> > I've played around with IIF statments, but they don't seem to be
    >> > working right.
    >> >
    >> > Help? Please?
    >> >

    >
     

Share This Page