NotInList and 2 values ComboBox

Sorry I confused you! The NotInList event is now working properly, but I can get back the record value on the combo box as you can see in the LAST PICTURE, after I click on Save And Close Button
---------------------------------------

The code I changed
Code:
If Not IsNull(OpenArgs) Then
        DoCmd.GoToRecord acDataForm, "Patients", acNewRec
        Me.LastName = Left(OpenArgs, Len(OpenArgs) - (InStr(OpenArgs, " ") + 1))
        Me.FirstName = Right(OpenArgs, Len(OpenArgs) - (InStr(OpenArgs, " ")))
End If

does not solve the problem completely. If I enter a very Long Name And Last Name it still mess it up somehow :( Particularly LastName which messes up..Especially if it is shorter or longer than FirstName.

Thanx for reply!
 
Last edited:
Is there and error? just saying that it doesn't work tells me nothing, as does you series of screen shots as there is no error message.

With the population of the first and second names the principal is sound it just needs a bit of tweaking. It is simply a matter of identifying the embedded space and assigning every thin to the left of that position to the First Name control and everything to the right of it to the Last name control, have a play with the code and I'm sure you'll work it out.
 
Ok, thank you for explanation:) Lets say I will tweak your code provided somehow. NotInListEvent works.

Last problem(I hope so.. :) ): how to get back the values again to the ComboBox? For example I enter "John Elly" to the ComboBox. The notinlist event occurs, and dialog form pops up. I fill that form. When I click save&close I would like to have the same name and last name to be left in combo box and set the cursor to a particular field.Instead I get blank combobox.

Thanx
 
Have a look at the sample I linked to back in post # 2, here it is again, you need to replicate the code I've used in the Not In List event in that DB.
 

Users who are viewing this thread

Back
Top Bottom