Question about auto-fill

G

Guest

I have a table with user information. I have tables for work histroy, Next of
Kin, and fitness information. On the input forms for the history, Next of Kin
and fitness I have them set up to auto-fill the User information off what
User ID is selected from a Combo box. What I would like to have happen is
when i use the combo box to select the user it will auto-fill all the
information on that form from the repective table. Also if when you select a
User ID from the combo box and there is no information in the table for them
will come up with blanks and when they fill in the information will save that
as a new user. Hope this makes sense and any help would be great!
 
G

Guest

If I understand your question correctly, this is an example of how you use a
Combo Box to pull up a specific record for a bound form and allow the user to
enter the data if it is a new entry:

Private Sub cboMActivity_AfterUpdate()
Dim rst As Recordset
'Find the Master Activity Selected

Set rst = Me.RecordsetClone
rst.FindFirst "[MActivity] = '" & Me.cboMActivity & "'"
Me.Bookmark = rst.Bookmark
rst.Close
Set rst = Nothing

End Sub

Private Sub cboMActivity_NotInList(NewData As String, Response As Integer)
'Show Error if an invalid Master Activity is entered
If MsgBox(Me.cboMActivity.Text & " Does not Exist " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO tblMasterActivity (mactivity) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Response = acDataErrAdded
Else
Me.cboMActivity.Undo
Response = acDataErrContinue
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Auto Fill II (for Access 2002) 2
Auto-Fill Text box on form 4
Error 424 in Auto Fill 3
Auto Fill Combo Box 1
Auto Complete and Data Entry in Combo Box 1
Combo Box Selections 3
Auto fill in a form 1
Auto Fill 1

Top