UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Set Focus And Store Data As Variable, Office 97    
 
   
learner
post 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
Go to the top of the page
 
+

Posts in this topic


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 06:25 PM