Question

Locked

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

By Mark.X.McFarland ·
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!!!!

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

VBA

by john.a.wills In reply to MS ACCESS 97 -Need to get ...

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

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums