My Assistant
|
|
Mar 4 2012, 10:02 AM
Post
#1
|
|
|
UtterAccess Guru Posts: 578 |
1. For the unbound text box qStaffNo on my form, if there's error after data validation, I've set the focus back to the unbound text box ready for user to re-enter the data; my SetFocus doesn't work, after the pop-up message is shown on the screen, the cursor has moved to the next unbounded text box instead of staying at the qStaffNo box. Why is this happening and how can I fix it?
2. I want to temporary remember the data entered in the qStaffNo as a variable to be used after the user finished entering data into the next unbound text box qOrderNo on the screen. Instead of declaring it as Dim, I tried declaring currStaffNo as Public, thinking that I'll be able to use the value later, but it doesn't work, I got an "invalid attribute in Sub or Function error", is that because my Sub is Private? What is the proper way to declare this variable so that I can use it later? Below is my code. Thank you in advance for any suggestions. CODE Private Sub qStaffNo_AfterUpdate()
Dim ScanStaffNo Dim currStaffNo As Byte ScanStaffNo = Me.qStaffNo If IsNumeric(ScanStaffNo) = False Then AutoMsg "Staff No. must be numeric only", "Invalid Staff No." Me.qStaffNo = "" Me.qStaffNo.SetFocus Exit Sub End If If IsNumeric(ScanStaffNo) = True Then If Len(ScanStaffNo) > 2 Then AutoMsg "Staff No. cannot contain more than 2 digits", "Invalid Staff No." Me.qStaffNo = "" Me.qStaffNo.SetFocus Exit Sub End If End If currStaffNo = Me.qStaffNo End Sub |
|
|
|
learner Set Focus And Store Data As Variable Mar 4 2012, 10:02 AM
theDBguy Hi,
The focus issue might have something to do wi... Mar 4 2012, 10:14 AM
missinglinq You're using the wrong event! You need to ... Mar 4 2012, 10:28 AM
learner Thanks for all your valuable feedbacks.
Now I see ... Mar 4 2012, 10:45 PM
theDBguy Hi,
Linq and I are happy to help. Good luck wit... Mar 5 2012, 10:54 AM
learner I've got it working using the BeforeUpdate eve... Mar 6 2012, 02:09 AM
theDBguy Hi,
Thanks for the update. Glad to hear you got i... Mar 6 2012, 10:43 AM![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th May 2013 - 06:25 PM |