Split "Firstname Lastname" text box into two columns, Multiple Aut

Hello,

I've got a bibliography data base I'm trying to set up and would like to 
enter a name, "John Smith" into my form and have it add an entry into my 
Authors table as Column 1 - John, Column 2, Smith.

Also, there are sometimes mulitple authors on any given paper.  How can I 
enter mulitple authors for the same paper?  

Below is the VBA, SQL code I've been trying to work from.  I get an error, 
"Number of query values and destination fields are not the same" when I try 
to run it.  But it still would 't solve the mulitple author problem even if 
it worked.

Private Sub Authors_NotInList(NewData As String, Response As Integer)
On Error GoTo Authors_NotInList_Err
    Dim KpAnswer As Integer
    Dim KpSQL As String
    KpAnswer = MsgBox("The author " & Chr(34) & NewData & _
        Chr(34) & " is not currently an option." & vbCrLf & _
        "Would you like to add him or her to the list now?" _
        , vbQuestion + vbYesNo, "New Author?")
     If KpAnswer = vbYes Then
        KpSQL = "INSERT INTO [Authors] ([First Name], [Last Name])" & _
            "VALUES('" & NewData & "');"
        DoCmd.SetWarnings False
        DoCmd.RunSQL KpSQL
        DoCmd.SetWarnings True
        MsgBox "This author has been added to the list." _
            , vbInformation, "New Author"
        Response = acDataErrAdded
    Else
        MsgBox "Please choose an author from the list." _
            , vbInformation, "New Author"
        Response = acDataErrContinue
    End If
Authors_NotInList_Exit:
    Exit Sub
Authors_NotInList_Err:
    MsgBox Err.Description, vbCritical, "Error"
    Resume Authors_NotInList_Exit
               
End Sub

Thanks!
0
Utf
4/9/2007 8:54:00 PM
access.formscoding 7494 articles. 0 followers. Follow

1 Replies
996 Views

Similar Articles

[PageSpeed] 57

On Mon, 9 Apr 2007 13:54:00 -0700, Kirkpatti
<Kirkpatti@discussions.microsoft.com> wrote:

>        KpSQL =3D "INSERT INTO [Authors] ([First Name], [Last Name])" & =
_
>            "VALUES('" & NewData & "');"

Obviously, this doesn't work because the insert statement is expecting =
two items
and you are only giving it one. But why not design your form so that the =
user
can enter the last name into one field and the first name into another?

--
Bob Hairgrove
NoSpamPlease@Home.com
0
Bob
4/9/2007 10:41:40 PM
Reply:

Similar Artilces:

Change firstname lastname to lastname first name in a column
Hi, I have an excel spreadsheet where I have a column of user names an they are listing as Mary Jones, Tim Betts etc. There is a spac between the First Name and Last Name. I would like to change thi column to show Jones, Mary and Betts, Tim. So lastname, firstname. I there a way to do this as I have a lot of names to change. Thank you. Cat -- Message posted from http://www.ExcelForum.com Hi Caty one way suing a helper column. enter the following in B1 =MID(A1,FIND(" ",A1)+1,255) & " " & LEFT(A1,FIND(" ",A1)-1) copy this down for all rows. after t...

Excel 2003
Hi - quick question, if you have a moment - I've got a (tall) column of names of the format: FirstName LastName I want to convert them to the format: LastName, FirstName Is this possible in Excel 2003? Thanks very much - Assume they start in A1, insert a new column B or use the one you have if it is empty, then in B1 put =MID(A1,FIND(" ",A1)+1,255)&", "&LEFT(A1,FIND(" ",A1)-1) press enter Select B1 again, move the cursor to the lower right corner of B1 and when it changes from a thick cross to a think double click and copy down the formula. S...

How to store a contact in the order of Firstname Lastname?
I remember most of my contacts by their first names. So I wish I can sort contacts in the order of their first names. But Outlook 2003 does contacts in 'Last name, First name' by default. How to change it? Tools > Options > Preferences > Contact Options. -- Russ Valentine [MVP-Outlook] "classic" <classic@music.com> wrote in message news:iotl01558tlji05run7b46udh9j2vbe3mf@4ax.com... >I remember most of my contacts by their first names. So I > wish I can sort contacts in the order of their first names. > But Outlook 2003 does contacts in 'Last ...

Split "Firstname Lastname" text box into two columns, Multiple Aut
Hello, I've got a bibliography data base I'm trying to set up and would like to enter a name, "John Smith" into my form and have it add an entry into my Authors table as Column 1 - John, Column 2, Smith. Also, there are sometimes mulitple authors on any given paper. How can I enter mulitple authors for the same paper? Below is the VBA, SQL code I've been trying to work from. I get an error, "Number of query values and destination fields are not the same" when I try to run it. But it still would 't solve the mulitple author problem even if it wo...

Address Book: FirstName LastName 2 LastName FirstName
Outlook 2003 When my Address Book displays, the names are listed in alpha order accourding to first names. How do I get it to display in alpha order by last names? Thanks Ken Ken Isaacson wrote: > Outlook 2003 > > When my Address Book displays, the names are listed in alpha order > accourding to first names. How do I get it to display in alpha order > by last names? > > Thanks > Ken Tools, e-mail accounts, view or change existing directories or address books <next>, select Outlook Address Book, press Change, and click "file as" in "show name...

Converting to FirstName LastName
I have a spreadsheet in Excel 2003 that includes a column of names in "LastName, FirstName" format. I need for it to be in "FirstName LastName" order. How can I do that without manually typing all 300 names? Text to Columns? Do you only have 2 names for each person? Recombine the names in the order after you swap the columns: use =3DA2&B2&C2 ... etc where A2 is the first name and the others the rest. Regards Robert McCurdy "mcp6453" <mcp6453@gmail.com> wrote in message = news:e$7cAQlMJHA.5428@TK2MSFTNGP02.phx.gbl... >I have a spreadsheet i...

Firstname Lastname, Users
Hi, we have a problem with CRM 4.0 Some useres are listed with "firstname lastename" other with "lastname, firstname" Is there any way to correct this? Thanks for your help, Heiko Kaiser You probably changed your setting sometime after it went into production. CRM uses the setting to populate a field. You can update the SQL field with a query very quickly but it is not supported. Gary Herbstman http://bytesolutions.com "Heiko Kaiser" wrote: > Hi, > > we have a problem with CRM 4.0 > Some useres are listed with "firstname lastename&qu...

Marketing account list with contacts firstname lastname
Hi, I want to change the marketing account list, that it shows firstname lastname instead of the primarycontactname. After updating the code in the SavedQueryBase there is a message: No Attribute Exception: 'Account' entity doesn't contain attribute with Name = 'primarycontactid.firstname' Code: <fetch version="1.0" output-format="xml-platform" mapping="logical"> <entity name="account"> <attribute name="name" /> <attribute name="address1_city" /> <order attribute="name&quo...