Field Validation

Bluie

Registered User.
Local time
Today, 12:20
Joined
Oct 14, 2004
Messages
18
I have 3 fields , Username , Question and Answer.
I also have a button , Link.

I have tried to look in this forum and i cant find any related to this. Before i can click on the link, i need to make sure that username, question and answer field is filled up first. How do i do that? Thanks for the reply in advance.
 
Code:
If IsNull(Username) Then
MsgBox "Please enter a username first", vbOKOnly, "Invalid Username"
Me.Username.SetFocus
Else
Me.ToggleLink.SetFocus

i got this code to work now. but when i click on the button link, it is pressed down. how can i make it up?
 

Attachments

  • ss.jpg
    ss.jpg
    18.9 KB · Views: 132
i got it working, instead of using onclick, i used on mouseup.
but i have a new problem:

Code:
Private Sub ToggleLink_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If IsNull(Me.Username) Or Me.Username = "" Then
    MsgBox "Please enter a username first", vbOKOnly, "Invalid Username"
    Me.Username.SetFocus

ElseIf IsNull(Me.Question) Or Me.Username = "" Then
    MsgBox "Please enter a question first", vbOKOnly, "Invalid Question"
    Me.Question.SetFocus

ElseIf IsNull(Me.Answer) Or Me.Username = "" Then
    MsgBox "Please enter a answer first", vbOKOnly, "Invalid Answer"
    Me.Answer.SetFocus

Else
    Me.ToggleLink.SetFocus
    
On Error GoTo ToggleLink_Click_Err

    If ChildFormIsOpen() Then
        CloseChildForm
    Else
        OpenChildForm
        FilterChildForm
    End If

ToggleLink_Click_Exit:
    Exit Sub

ToggleLink_Click_Err:
    MsgBox Error$
    Resume ToggleLink_Click_Exit

End If
End Sub

after i did put in values into username, answer and question.. i can click on the button "link". i go back to the main form, and now i remove the values in question, i can still click on the link button. it is suppose to be asking me to fill it up. advise please..
 

Users who are viewing this thread

Back
Top Bottom