Desparately need help

J

jsb

Hello
I have a combo box(unbound) for the Customer field.
When I select a customer from that, the text box diplays
corresponding AcctNo. My problem is, if a Customer has
more than one account, the AcctNo in the text box doesn't
change.
What I should be doing?

This is the code I wrote:

Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object

Set Rs = Me.Recordset.Clone
Rs.FindFirst "[CUSTOMER] = '" & Replace(Me!
[Combo1], "'", "''") & "'"
Me.Bookmark = Rs.Bookmark

End Sub
 
D

Duane Hookom

The bound column of the combo box must be unique. What is the Row Source of
your combo box?
 
J

JSB

It is

SELECT [Find by Company Name].[CUSTOMER] FROM [Find by
Company Name];

'Find ByCompany Name' is the Query name

Thanks.
-----Original Message-----
The bound column of the combo box must be unique. What is the Row Source of
your combo box?

--
Duane Hookom
MS Access MVP


Hello
I have a combo box(unbound) for the Customer field.
When I select a customer from that, the text box diplays
corresponding AcctNo. My problem is, if a Customer has
more than one account, the AcctNo in the text box doesn't
change.
What I should be doing?

This is the code I wrote:

Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object

Set Rs = Me.Recordset.Clone
Rs.FindFirst "[CUSTOMER] = '" & Replace(Me!
[Combo1], "'", "''") & "'"
Me.Bookmark = Rs.Bookmark

End Sub


.
 
D

Duane Hookom

Apparently you need to include the AcctNo in the Row Source if you expect to
find a particular AcctNo.

--
Duane Hookom
MS Access MVP


JSB said:
It is

SELECT [Find by Company Name].[CUSTOMER] FROM [Find by
Company Name];

'Find ByCompany Name' is the Query name

Thanks.
-----Original Message-----
The bound column of the combo box must be unique. What is the Row Source of
your combo box?

--
Duane Hookom
MS Access MVP


Hello
I have a combo box(unbound) for the Customer field.
When I select a customer from that, the text box diplays
corresponding AcctNo. My problem is, if a Customer has
more than one account, the AcctNo in the text box doesn't
change.
What I should be doing?

This is the code I wrote:

Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object

Set Rs = Me.Recordset.Clone
Rs.FindFirst "[CUSTOMER] = '" & Replace(Me!
[Combo1], "'", "''") & "'"
Me.Bookmark = Rs.Bookmark

End Sub


.
 
M

MacDermott

Look at your code.
Doesn't it say "FindFirst"?
So that's what it does; finds the first match.

So, what is your design?
How do you want to signal to the program that it is to find something
besides the first match?
 
G

Guest

I would think that if each customer can have multiple account numbers you
would need an Accounts table, with CustomerID (primary key from the customer
table) as its foreign key. If the main form is based on the Customer table a
continuous subform based on the Accounts table would probably do what you
need.

JSB said:
It is

SELECT [Find by Company Name].[CUSTOMER] FROM [Find by
Company Name];

'Find ByCompany Name' is the Query name

Thanks.
-----Original Message-----
The bound column of the combo box must be unique. What is the Row Source of
your combo box?

--
Duane Hookom
MS Access MVP


Hello
I have a combo box(unbound) for the Customer field.
When I select a customer from that, the text box diplays
corresponding AcctNo. My problem is, if a Customer has
more than one account, the AcctNo in the text box doesn't
change.
What I should be doing?

This is the code I wrote:

Private Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Dim Rs As Object

Set Rs = Me.Recordset.Clone
Rs.FindFirst "[CUSTOMER] = '" & Replace(Me!
[Combo1], "'", "''") & "'"
Me.Bookmark = Rs.Bookmark

End Sub


.
 

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