A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

selecting a record



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2006, 11:34 PM posted to microsoft.public.access.forms
Moe
external usenet poster
 
Posts: 62
Default selecting a record

In my combobox each Customer field has several Invoices. therefore, no matter
which of the records I select the first record for that Customer will fill in
the fields of the form. For example Customer_1 has invoice_1, invoice_2 and
invoice_3. No matter which invoice I select in the combobox, invoice_1 will
be used to fill in the form. I tried to use "rs.Find ("[CustomerID] = '" &
Me![Combo12] & "'" And "[InvoiceID] = '" & Me![Combo12].Column(1) & "'") in
the AfterUpdate Event of the combobox but it did not work. any idea?
  #2  
Old December 16th, 2006, 12:54 AM posted to microsoft.public.access.forms
Jacob
external usenet poster
 
Posts: 14
Default selecting a record

Moe,

Looks like the Bound column of your combo is the customer or the
customerID, change the bound colomn to the Invoice identifier that
appears on the form. That should sove the problem

Regards/JK

Moe wrote:
In my combobox each Customer field has several Invoices. therefore, no matter
which of the records I select the first record for that Customer will fill in
the fields of the form. For example Customer_1 has invoice_1, invoice_2 and
invoice_3. No matter which invoice I select in the combobox, invoice_1 will
be used to fill in the form. I tried to use "rs.Find ("[CustomerID] = '" &
Me![Combo12] & "'" And "[InvoiceID] = '" & Me![Combo12].Column(1) & "'") in
the AfterUpdate Event of the combobox but it did not work. any idea?


  #3  
Old December 16th, 2006, 07:22 AM posted to microsoft.public.access.forms
Moe
external usenet poster
 
Posts: 62
Default selecting a record

Thanks Jacob, that helped. Now can you tell me how we can do this by VBA. I
tried rs.Find ("[CustomerID] = '" & Me![Combo12] & "'" And "[OrderID] = '" &
Me![Combo12].Column(1) & "'") but it did not work I need to know how to use
"Find" or "FindFirst" method with two conditions. Like looking for a record
in a form or table where, for example, CustomerID AND OrderID match specific
fields of the form.

"Jacob" wrote:

Moe,

Looks like the Bound column of your combo is the customer or the
customerID, change the bound colomn to the Invoice identifier that
appears on the form. That should sove the problem

Regards/JK

Moe wrote:
In my combobox each Customer field has several Invoices. therefore, no matter
which of the records I select the first record for that Customer will fill in
the fields of the form. For example Customer_1 has invoice_1, invoice_2 and
invoice_3. No matter which invoice I select in the combobox, invoice_1 will
be used to fill in the form. I tried to use "rs.Find ("[CustomerID] = '" &
Me![Combo12] & "'" And "[InvoiceID] = '" & Me![Combo12].Column(1) & "'") in
the AfterUpdate Event of the combobox but it did not work. any idea?



  #4  
Old December 16th, 2006, 08:21 PM posted to microsoft.public.access.forms
Jacob
external usenet poster
 
Posts: 14
Default selecting a record

Moe,

To go to the record use the AfterUpdate event of the combo:

If The Bound Column of the combo is Column(1),*which is the way it
shoud be*, you refer to the combo box rather then to a column, to
select that record:

Private Sub combo12_AfterUpdate()

DoCmd.GoToControl "OrderID"
DoCmd.FindRecord Me.Combo12
'Note: no equal sign
DoCmd.GoToControl "Whatever"

End Sub
(no need to refer to a recordset)

In order to have the combo display the correct record you are on, if
you have not done it yet, use the OnCurrent event of the *form*

Private sub Form_Current()
Me.Combo12=Me.OrderID
End Sub

If Column 1 is *not* the bound column, it is a string (eg "223", not
223) thus needs to be converted to number because OrderID on the form
is a number. Change the second staement of the AfterUpdate event to:

DoCmd.FindRecord Val(Me.Combo12.Column(1))

Howver in this case your combo may not retun the correct record you are
on

Hope this is of help

Regards
Jacob

Moe wrote:
Thanks Jacob, that helped. Now can you tell me how we can do this by VBA. I
tried rs.Find ("[CustomerID] = '" & Me![Combo12] & "'" And "[OrderID] = '" &
Me![Combo12].Column(1) & "'") but it did not work I need to know how to use
"Find" or "FindFirst" method with two conditions. Like looking for a record
in a form or table where, for example, CustomerID AND OrderID match specific
fields of the form.

"Jacob" wrote:

Moe,



Looks like the Bound column of your combo is the customer or the
customerID, change the bound colomn to the Invoice identifier that
appears on the form. That should sove the problem

Regards/JK

Moe wrote:
In my combobox each Customer field has several Invoices. therefore, no matter
which of the records I select the first record for that Customer will fill in
the fields of the form. For example Customer_1 has invoice_1, invoice_2 and
invoice_3. No matter which invoice I select in the combobox, invoice_1 will
be used to fill in the form. I tried to use "rs.Find ("[CustomerID] = '" &
Me![Combo12] & "'" And "[InvoiceID] = '" & Me![Combo12].Column(1) & "'") in
the AfterUpdate Event of the combobox but it did not work. any idea?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.