Jumat, 26 September 2014

Re: [MS_AccessPros] How use combo box to select a record to view

 

Good answer, Rajiv!


Another caution:  If you build the combo box yourself, it MUST NOT have a Control Source.  If you set the Control Source to VendorID, you'll be updating the VendorID in the current record every time you try to do a search.

And, of course, the combo box needs some code to make it work.  The Wizard will build that for you.  Or, you can code your own AfterUpdate event for the combo box:

Private Sub cmbVendSearch_AfterUpdate()

    ' Find the record selected
    Me.Recordset.FindFirst "VendorID = " & Me.cmbVendSearch

End Sub

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Sep 26, 2014, at 6:02 PM, Rajiv torajiv@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Simplest solution:
Enable control wizards.
Add a combo box to form header - a un bound combo box.
In the wizard select : I want to find a record based on my selection.
Add the data from vendor table.
Finish.
Voila!


Rajiv
PS of course there are more complicated methods to doing this!!




On Friday, September 26, 2014, muralles_r12@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
 

Good morning everyone.

 

Thanks John for getting back to me about my form and sub form problem.

 

I looked in the book and realized what I was doing wrong.

 

I am up and working now.

 

I have the form displaying the vendor info

 

I have the sub form displaying the contacts for the vendor.

 

-----------------------------------------------------------------------------------------

 

I have seen this and I am trying it.

 

In the form, I want to use the vendorID to navigate to the next record and see the related info in the sub form.

 

1. I make the vendor ID into a combo box

 

2. I set the record source property to a query that returns the vendorID and vendor name.

 

3. Set the properties for bound Column width and so forth.

 

4. It all works, but it will not let me use the combo box to select the record I want to view.

 

I can use the navigation bar for the form to move to the next record, I can see the combo box change accordingly.

 

Can anyone help me?

 

Thanks.



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar