A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding data to a form



 
 
Thread Tools Display Modes
  #1  
Old September 21st, 2009, 02:25 PM posted to microsoft.public.access.forms
Alex Hammerstein
external usenet poster
 
Posts: 70
Default Adding data to a form

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

  #2  
Old September 21st, 2009, 04:00 PM posted to microsoft.public.access.forms
Dorian
external usenet poster
 
Posts: 542
Default Adding data to a form

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".


"Alex Hammerstein" wrote:

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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.