Access 2003 Form Tab Order programing

B

Bardia

-- On Access 2003 form I have the following controls:
a. Method of payment, List Box (Cash, Check & Credit Card)
b. Check Number, Text Box
c. Credit Card Number, Text Box
d. Amount, Text Box
How can I program the Tab Order that if Cash was chosen as a method of
payment when Tab key is pressed on keyboard curser would by pass Check Number
& Credit Card number controls and land into Amount control? Or if Credit Card
was picked curser would jump to Credit Card Number control by passing Check
Number control.
Please advice.

Bardia
 
W

Wayne-I-M

To set the focus to another control on a form use the AfterUpdate event of
that control

So if you had a control called ControlName1 and you wanted to set the focus
(go to) a certain control if the user entered "Cash" then you would use
something like this

Private Sub ControlName1_AfterUpdate()
If Me.ControlName1 = "Cash" Then
Me.ControlName2.SetFocus
End If
End Sub

You just need to workout what the user will imput and then where you want to
focus to be set in that case.

Note if you are pulling data from a combo (based on a table) it is likely
that you would "see" Cash but the data in the table field would be a number
(the autonumber) so in this case remove the " "

Good luck
 
T

tecas

-- On Access 2003 form I have the following controls:
a.      Method of payment, List Box (Cash, Check & Credit Card)
b.      Check Number, Text Box
c.      Credit Card Number, Text Box
d.      Amount, Text Box
How can I program the Tab Order that if Cash was chosen as a method of
payment when Tab key is pressed on keyboard curser would by pass Check Number
& Credit Card number controls and land into Amount control? Or if Credit Card
was picked curser would jump to Credit Card Number control by passing Check
Number control.
Please advice.

Bardia

On the change event, write code where you would set focus to the
appropriate text box based on the selected value of the list box.

private sub MethodofPayment_change
if methodofpayment =cash then
amount.setfocus
else
if methodofpayment = check then
checknumber.setfocus
else
creditcardnumber.setfocus.
end if
end if

end sub
 
H

hor vannara

Bardia said:
-- On Access 2003 form I have the following controls:
a. Method of payment, List Box (Cash, Check & Credit Card)
b. Check Number, Text Box
c. Credit Card Number, Text Box
d. Amount, Text Box
How can I program the Tab Order that if Cash was chosen as a method of
payment when Tab key is pressed on keyboard curser would by pass Check
Number
& Credit Card number controls and land into Amount control? Or if Credit
Card
was picked curser would jump to Credit Card Number control by passing
Check
Number control.
Please advice.

Bardia
 
H

hor vannara

Bardia said:
-- On Access 2003 form I have the following controls:
a. Method of payment, List Box (Cash, Check & Credit Card)
b. Check Number, Text Box
c. Credit Card Number, Text Box
d. Amount, Text Box
How can I program the Tab Order that if Cash was chosen as a method of
payment when Tab key is pressed on keyboard curser would by pass Check
Number
& Credit Card number controls and land into Amount control? Or if Credit
Card
was picked curser would jump to Credit Card Number control by passing
Check
Number control.
Please advice.

Bardia
 
B

Bardia

Thanks. now I get this error "MS Office can not find the micro privet sub
methodofpayment_change
if methodofpayment=cash then
amount."
the nicro does not exist
 
B

Bardia

Thanks, now I get this message "the micro does not exist, or micro is new and
has not been saved. Please advice
 
W

Wayne-I-M

Sorry my fault - should have explained more.

The code I gave was an example only - you need to alter the code to the real
name of the controls on your forms.
Unless you have a control on your form called "ControlName1" then you
application will not be able to find it should you will get the error.

You need to change the names in the code to what they really are


If you can do this, then post the names here and someone will be able to
point you in the right direction
 
W

Wayne-I-M

In that code you need to use "me"

There are lots of website giving basic lessons in vba code writting.

If you post a question then some of the mvp's have written books that you
may be able to get hold of. These will allow you to quickly get the basics
and get your application up and running - when I say "quickly" this is
relative - relative to not learning the basics ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access 2003 Form 7
Condition navigating between Controls 11
Combo Box Selections 3
Forms 9
Combo box WITH free form fill in ALSO 5
Tab order incorrect 3
Suppress "0" in numeric text box 4
Table Design Problem 1

Top