Good Day. I'm using access 2007 and I'm trying to find a way to allow users to add two or more "New Data" to a combo box, and
then opening the client form reflecting the new data entered from the combo box. So that the user can add more fields that
are required before allowing them to save the form and after the form is saved and closed, i want the combo box to be
automatically refreshed and the new data selected itself. By then all that is left to the user is to push tab to go to the
What I've accomplished so far below my code example is adding only a single "NewData" from the combo box and then
opening the client form to add some more. but what if i want to add (2)two or more first names and a last name like for
example: "Marky Mark Whalberg"
Where Marky Mark is the (2)two first names and Whalberg is of course the last name? I want this automatically reflected
on the client form upon opening it and then after the user entered the other required fields,saved and closed the form. I
want the calling combo box to be automatically refreshed and the new name selected and if possible would also automatically
go to the next control. Thank you in advance.
Dim strSQL As String
Dim strMSG As String
Dim lngClientID As Long
Dim ctl As Control
Set ctl = Screen.ActiveControl
strMSG = "The name, """ & NewData & """, you entered is not listed. Do you want to add it?"
If MsgBox(strMSG, vbYesNo, "NOT LISTED") = vbYes Then
strSQL = "INSERT INTO tblClients (FirstName)" & "SELECT """ & NewData & """"
Response = acDataErrAdded
lngClientID = DMax("ClientID", "tblClients")
DoCmd.OpenForm "frmClients", , , "ClientID = " & lngClientID
Response = acDataErrContinue