For creating a form, you can goto Design view in form and create your own text boxes(assuming you are new to Ms Access) and other controls , and on right click of each control you have properties events associated, you can chose on which event, you want to associate controls to, eg, ; on CLICK of a command button..please see below code, i did this for a login screen,
Where user enters, both username and password to goto next screen.(putall that info in a table)
I have just given an example - i have used Username selection in combobox rather than textbox,.hope this helps..
[code goes here]....
Private Sub Form_Load()
Dim a As Integer
DBconnect
a = Combobox.ListCount
Do Until a = 0
Combobox.RemoveItem (a - 1)
a = a - 1
Loop
rs.Open "SELECT NAME,PASSWORD FROM LOGIN_TEST ", Cnt, adOpenKeyset, adLockOptimistic
Do Until rs.EOF
Combobox.AddItem (rs("NAME"))
rs.MoveNext
Loop
rs.Close
End Sub
Private Sub enter_click()
On Error GoTo ErrorHandler
'Check to see if data is entered into the UserName combo box
If IsNull(Combobox) Or Me.Combobox = "" Then
MsgBox "You must select a User Name.", vbOKOnly, "Required Data"
Me.Combobox.SetFocus
Exit Sub
End If
'Check to see if data is entered into the Passcode box
'If IsNull(Text6.Value) Or Text6 = "" Then
' MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
' Me.Text6.SetFocus
' Exit Sub
'End If
'Check value of Passcode in Table login_test1 to see if this
'matches value chosen in combo box
querylogin = "select * from login_test where name='" & Combobox & "' and password = ' "& Text6 &"'"
rs.Open querylogin, Cnt, adOpenStatic, adLockOptimistic
If Not rs.EOF Then
'Close logon form and open Menu screen
User1 = Combobox
DoCmd.Close acForm, "loginscreen_test1", acSaveNo
DoCmd.OpenForm "MAIN_MENU"
Else
'If User Enters incorrect Password more than 3 times Application will close
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts >= 4 Then
MsgBox "You have exceeded the number of attempts,Application will exit", _
'vbCritical, "Restricted Access!"
Application.Quit
End
Else
MsgBox "Passcode Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.Text6.SetFocus
End If
End If
rs.Close
ErrorHandlerExit:
Exit Sub
ErrorHandler:
If Err.Number = 2001 Then
Resume Next
Else
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End If
End Sub
[Code ends here]