By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Set Focus

P: 2
I am having trouble getting focus on the VehicleNo control. Here is my code, you will note I am trying several different ways to get the focus on VehicleNo.

The focus still goes to the next control, chkNotMp when I choose no on the message. Any suggestions? Thanks.

Janet

If Len(Me![DIVNO]) < 2 Then
If FullDIVNo <> left(Me![VEHICLENO], 2) Then
Response = MsgBox("The first two numbers of the vehicle number do not match the division number. Do you want to assign Vehicle No. " & [VehicleNumber] & " to Division No. " & [FullDIVNo] & "?", vbYesNo, "Fleet Billing")
If Response = 6 Then 'Yes
Me![chkNotMp].SetFocus
End If
If Response = 7 Then 'No
Forms!FMtrPolBil!VEHICLENO.SetFocus
End If
End If
ElseIf left(Me![VEHICLENO], 2) <> left(Me![DIVNO], 2) Then
Response = MsgBox("The first two numbers of the vehicle number do not match the division number. Do you want to assign Vehicle No. " & [VehicleNumber] & " to Division No. " & Me![DIVNO] & "?", vbYesNo, "Fleet Billing")
If Response = 6 Then
chkNotMp.SetFocus
End If
If Response = 7 Then
VEHICLENO.SetFocus
End If
End If
May 14 '07 #1
Share this Question
Share on Google+
2 Replies


maxamis4
Expert 100+
P: 295
have you tried stepping through the code using the immediate window and inserting a break point in the code to see where it might be skipping the values?


I am having trouble getting focus on the VehicleNo control. Here is my code, you will note I am trying several different ways to get the focus on VehicleNo.

The focus still goes to the next control, chkNotMp when I choose no on the message. Any suggestions? Thanks.

Janet

If Len(Me![DIVNO]) < 2 Then
If FullDIVNo <> left(Me![VEHICLENO], 2) Then
Response = MsgBox("The first two numbers of the vehicle number do not match the division number. Do you want to assign Vehicle No. " & [VehicleNumber] & " to Division No. " & [FullDIVNo] & "?", vbYesNo, "Fleet Billing")
If Response = 6 Then 'Yes
Me![chkNotMp].SetFocus
End If
If Response = 7 Then 'No
Forms!FMtrPolBil!VEHICLENO.SetFocus
End If
End If
ElseIf left(Me![VEHICLENO], 2) <> left(Me![DIVNO], 2) Then
Response = MsgBox("The first two numbers of the vehicle number do not match the division number. Do you want to assign Vehicle No. " & [VehicleNumber] & " to Division No. " & Me![DIVNO] & "?", vbYesNo, "Fleet Billing")
If Response = 6 Then
chkNotMp.SetFocus
End If
If Response = 7 Then
VEHICLENO.SetFocus
End If
End If
May 14 '07 #2

P: 2
Yes, I did step through the code and it is hitting the setfocus code. That is why I am so daffled.

Janet
May 15 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.