B
Billp
Hi,
User enters a name - Fred Jones
The feild on the form is called "Contact Name" and is a combo - which allows
entries which are not in the list.
On after update
Name is split in VBA to
strFirst = Fred
StrLast = Jones
The table behind the combo has the name split into FIRST_NAME and LAST_NAME
and the combo drop down shows a concatenated name "Fred Jones".
Fred Jones is in the drop down.
We select
Now the name is split and we want to check if that name is recorded
strFirst = ParseWord(Me![Contact Name], 1) 'function ParseWord is found
below
strLast = ParseWord(Me![Contact Name], -1)
strsql_1 = "SELECT tblCUSTCONTACTS.[LAST_NAME] " & _
"FROM tblCUSTCONTACTS " & _
"WHERE CustID = " & Me![CustID] 'filter the combo to the customer
Set db = CurrentDb
Set rst = db.OpenRecordset(strsql_1)
strsql_2 = "strLast=""" & rst![LAST_NAME] & """"
If rst.NoMatch Then
'ask if the name is too be added
intpak = MsgBox("Do you wish to add a new contact?" & vbCrLf & _
"Select " & vbCrLf & _
" - YES to open Customer Table to Enter / Delete contacts?"
& vbCrLf & _
" - No To append Name to customer List without Details" &
vbCrLf & _
" - CANCEL Just to accept name as a once off",
vbYesNoCancel, "Update Customer")
Else 'there is a match
'update controls based on Contact Name
etc...............
When it runs I get
Error 3070
Microsft Jet Engine deos not recognise strLast as a valid field name.
All I need is the strLast to be checked against the last_Name feild in the
recorset.
I am looking at it - and I cannot see.
Any help appreciated
Kind Regards
User enters a name - Fred Jones
The feild on the form is called "Contact Name" and is a combo - which allows
entries which are not in the list.
On after update
Name is split in VBA to
strFirst = Fred
StrLast = Jones
The table behind the combo has the name split into FIRST_NAME and LAST_NAME
and the combo drop down shows a concatenated name "Fred Jones".
Fred Jones is in the drop down.
We select
Now the name is split and we want to check if that name is recorded
strFirst = ParseWord(Me![Contact Name], 1) 'function ParseWord is found
below
strLast = ParseWord(Me![Contact Name], -1)
strsql_1 = "SELECT tblCUSTCONTACTS.[LAST_NAME] " & _
"FROM tblCUSTCONTACTS " & _
"WHERE CustID = " & Me![CustID] 'filter the combo to the customer
Set db = CurrentDb
Set rst = db.OpenRecordset(strsql_1)
strsql_2 = "strLast=""" & rst![LAST_NAME] & """"
If rst.NoMatch Then
'ask if the name is too be added
intpak = MsgBox("Do you wish to add a new contact?" & vbCrLf & _
"Select " & vbCrLf & _
" - YES to open Customer Table to Enter / Delete contacts?"
& vbCrLf & _
" - No To append Name to customer List without Details" &
vbCrLf & _
" - CANCEL Just to accept name as a once off",
vbYesNoCancel, "Update Customer")
Else 'there is a match
'update controls based on Contact Name
etc...............
When it runs I get
Error 3070
Microsft Jet Engine deos not recognise strLast as a valid field name.
All I need is the strLast to be checked against the last_Name feild in the
recorset.
I am looking at it - and I cannot see.
Any help appreciated
Kind Regards