Question Locked

MS ACCESS 97 -Need to get Fields to Auto-populate

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello, I have created a Access database that include employees information. I have created a table with all the information such as: name, telephone # supervrs name, location etc.

I have also created a Form with these fields. However, I need to have the fields to auto-populate when I put in the name of the employee in the employee names field. Help!!!!

2 replies

by john.a.wills

Write a VBA event to recognize leaving the name control (or clicking a button). What follows is for a slightly different purpose, but should be a suitable model.
Private Sub Possession_Click()
On Error GoTo Err_Possession_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Possession"
stLinkCriteria = "1=1"
If IsNull(Me.Username) _
Then
Else
stLinkCriteria = stLinkCriteria & " and [UserName] like '" & Me.Username & "*'"
End If
If IsNull(Me.Model) _
Then
Else
stLinkCriteria = stLinkCriteria & " and [Model] like '" & Me.Model & "*'"
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Possession_Click:
Exit Sub

Err_Possession_Click:
MsgBox Err.Description
Resume Exit_Possession_Click

End Sub

This discussion is closed to new replies.