Adding data to a form

A

Alex Hammerstein

Hi

As as subform I have a continuous form showing a list of contacts. To make
it easier to read, I have concatenated the Title, Forename and Surname
fields into a single field called Full Name

I wanted to give the user an option that if they type in a name not in list,
that they can add it to the contacts table via a form frmAddContact. I used
the following code:

Dim s As String
Dim x As Long
s = NewData & " is not in the list"
s = s & vbNewLine & "would you like to add it?"
x = MsgBox(s, vbQuestion + vbYesNo, "Not In List")
If x = vbYes Then
DoCmd.OpenForm "frmAddContact", acNormal, , , acFormAdd, acDialog,
NewData
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

Hpwever of course that places all of the NewData into the first field on the
form which is the Title field.

Id there a way tp split it up (perhaps based on spaces in the NewData
string) or is there another way of achieving what I want?

Many thanks

Alex
 
D

Dorian

It's inadvisable to try to parse a name.
Have the user enter the name in a form that has separate controls for
firstname, middleinitial and lastname.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 

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

Top