Check Name in a Specific Customer Record - after update

B

Billp

Hi,

Have to use the after update event of a combox rather than the notinlist
event to allow for a third option. Combobox is Combo111 which has a control
source [Contact Name].
The combo has a list of names etc which have already been filtered to a
company.

tblCustContacts has records with fields of Last_Name, First_Name, RecordID,
and CUSTID.
RecordID is unique.

User enters a name "Fred Jones"
Jones is filtered out.
Now I need to check if Jones is in the list associated with that particular
CUSTID.

If not - user can choose to add to the list adding details , just append the
name or leave the name as a once off.

I think that I have to check a recordset where the customerID is something
and if no match then do something etc.

I have:

str2 = Right(Trim(Me![Contact Name]), Len(Trim(Me![Contact Name])) -
InStr(1, Me![Contact Name], " "))

Set db = CurrentDb
Set rst = db.OpenRecordset("tblCUSTCONTACTS", dbOpenDynaset)
str2 = rst![LAST_NAME]

rst.FindFirst str2

If rst.NoMatch Then 'The name is unique and may be used
'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")


'**************************************************************************************************
Select Case intpak


Its the rst.FindFirst str2 WHERE part thats got me.

CustmerID comes form another combobox column.
 

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