Updating form controlls

S

Seth

I have a table called Customer with the ff fileld
Auto Number - Key
PhoneNumber - Combo - unbound
CellNumber - bound to Customer
CompanyName - Combo - unbound
FirstName - bound to Customer
Surname - bound to Customer
Etc
PhoneNumber and CompanyName are combo whilst the rest of
the fields are text boxes on a form. I need to be able to
search my Customer table using either PhoneNumber OR
CompanyName to establish whether the customer exists in
the table. ( This is part of a problem for now) I use the
following code to update the text boxes with the data
found in the Customer table

Private Sub CboCellNum_BeforeUpdate(Cancel As Integer)
On Error Resume Next
CboCellNum.SetFocus
If CboCellNum.Value > 0 Then
Me.Filter = "[ID]=" & CboCellNum.Value
Me.FilterOn = True
End If
End Sub
The problem is that as I have two unbound combos, only
one is updated. The combos have a 4 element drop down
list from the Customer table. The first element is
Autonumber(hidden) followed by three other field. How
best can I have all controls updated. Must the combos be
unbound ? Is this a wrong method? As I an just a
beginner describing the above code in detail will be
appreciated.
Thanks for the help
 
S

Seth

I revisited the code and amended as follows
Private Sub CboCellNum_BeforeUpdate(Cancel As Integer)
On Error Resume Next
CboCellNum.SetFocus
If CboCellNum.column(0) > 0 Then
Me.Filter = "[ID]=" & CboCellNum.column(0)
Me.FilterOn = True
End If
End Sub
This doe the updating of the controls as I require with
one problem though. The CellNum field in the Customer
table is incorrect. What can I do to prevent the combo
selection from writing in the Customer table.
Thanks
 

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