Re: INSERT INTO Table, values derived in code from separating a name
- From: "Benjamins via AccessMonster.com" <u39077@uwe>
- Date: Thu, 26 Nov 2009 03:12:14 GMT
Hi Billp,
Since you has already split up the name into str1 and str2, you can just
insert the value in.
strsql = "INSERT INTO [tblCUSTCONTACTS] (FIRST_NAME, LAST_NAME) " & _
"VALUES('" & str1 & "', '" & str2 & "')"
You need not need to use the SELECT statement. SELECT statement is more
suitable if there is multi records to insert.
Billp wrote:
Hi,
I have a field called [Contact Name] which is the result of a combo box.
On not in list the user is asked if the name they enter is too be added to
the list.
The name is separated into two strings "str1l" and "str2" in code form a
module as the function is called up from the not in List on the Combo box.
str1 is FIRST_NAME
str2 is LAST_NAME
The fields in tblCUSTCONTACTS are "FIRST_NAME" and "LAST_NAME"
Now I wish to INSERT into the tblCUSTCONTACTS the two strings.
strsql = "INSERT INTO [tblCUSTCONTACTS] " _
& "(FIRST_NAME),(LAST_NAME) " _
& "SELECT str1,str2 FROM ????????????????????????? " _
& "WHERE [CustID] = " & Forms![Sales Enquiry Register
edit form]![CustID]
How do I reference the str1 and str2 that I have in code?
CustID is the reference from the form.
tblCUSTCONTACTS hasa unique Identoifing autonumber feild called "ID" for
each entry which creates a record which Firstname and Lastname will be one
record
Thanks.
--
Message posted via http://www.accessmonster.com
.
- References:
- Prev by Date: INSERT INTO Table, values derived in code from separating a name
- Next by Date: Re: Declaring Public Const
- Previous by thread: INSERT INTO Table, values derived in code from separating a name
- Index(es):
Relevant Pages
|