Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Focus (I think) (Office XP)

    Hi.

    On a data entry form I have three types of payment options available - cash, cheque or credit card. Selection is by yes/no box. What I want to happen if I click cash or cheque is move the cursor immediately to a field called amount. if credit card is checked then the cursor moves to the next field which is credit card number. what I am trying to avoid is the user having to use the enter or tab key to move through the credit card number, card type, expiry date fields unecessarily.

    Any help would be appreciated. Thanks....Peter

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Focus (I think) (Office XP)

    Are the choices mutually exclusive? If so, a group box with three option buttons would be better than individual check boxes. You could use code in the After Update event of the group box. Say that cash has option value 1, cheque 2 and credit card 3. The code could look like this (substitute the appropriate names):

    Private Sub grpPaymentOption_AfterUpdate()
    Select Case grpPaymentOption
    Case 1, 2 ' cash or cheque
    Me.txtAmount.SetFocus
    Case 3 ' credit card
    Me.txtCreditCardNumber.SetFocus
    End Select
    End Sub

    If a user can select more than one option, you would use check boxes, with After Update procedures for each, for example:

    Private Sub chkCash_AfterUpdate()
    Me.txtAmount.SetFocus
    End Sub

    and similar for the other two, again with the appropriate names substituted.

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Focus (I think) (Office XP)

    thats cool, thanks for that I hadn't thought of an option group.

Posting Permissions

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