Populating other tables from a form

dadrew

Registered User.
Local time
Today, 10:08
Joined
Sep 15, 2003
Messages
186
I wonder if anyone can help me in the early stages of a DB. On my form I have a name box, when the user enters his name I then wantthem to be able to select an option from the event list and for their name to be entered into that event table by clicking on the add button. What would the code be?

Thanks in advance.

DB Attached
 

Attachments

Not on the List....

I am not if I understood your concerns. Assuming you have a combo box and If the user name is not listed you want user to type their and retain that value in your table. If I am on the right tract then you can user Not on the list event. Please see my sample.... (also you can find some fine sample database on this forum, just do a search not on the list)

Good Luck
Dianna Goldsberg

My sample code....
=======================================================
Private Sub cboFinancialAdvisor_NotInList(NewData As String, Response As Integer)
' Add a new Name by typing a name in combo box.
Dim intNewFA As Integer, intTruncateName As Integer, strTitle As String, intMsgDialog As Integer

' Display message box asking if user wants to add a new category.
strTitle = "Name Not In List"
intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
intNewFA = MsgBox("Do you want to add a new Name?", intMsgDialog, strTitle)

If intNewFA = vbYes Then
' Remove new name from Current Combo box so
' control can be requeried when user returns to form.
DoCmd.RunCommand acCmdUndo

' Display message box and adjust length of value entered in
' CategoryID combo box.
strTitle = "Name Too Long"
intMsgDialog = vbOKOnly + vbExclamation
If Len(NewData) > 50 Then
intTruncateName = MsgBox("Name can be no longer than " _
& "50 characters. The name you entered will be truncated.", _
intMsgDialog, strTitle)
NewData = left(NewData, 50)
End If

' Open frmfinancialadvisor form.
DoCmd.OpenForm "frmfinancialadvisor", acNormal, , , acAdd, acDialog, NewData
Me.Visible = False
' Continue without displaying default error message.
Response = acDataErrAdded
End If

End Sub
=========================================================
 

Users who are viewing this thread

Back
Top Bottom