Connie
That's the right way to do it. But be sure to requery the combo. Changing the Rowsource is not enough to load the data.
'Set RowSource for cboSearch box
Forms!Listings.cboSearch.RowSource = strSql2
Forms!Listings.cboSearch.Requery
Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca
--- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@...> wrote:
>
> When a button is clicked on another form I am opening the Listings form and setting the Rowsource of cbo.search (an unbound box). The code I am using is:
>
> 'Make string for Rowsource for cboSearch box
> strSql2 = "SELECT DISTINCT qListingContacts_SoldSellers.* " & _
> "FROM qListingContacts_SoldSellers;"
> 'Set RowSource for cboSearch box
> Forms!Listings.cboSearch.RowSource = strSql2
>
> Is there a better way to do this? I am just using qListingContacts_SoldSellers as the base, but the only way I knew to put it into a proper string was the above.
>
> Thanks!
> Connie
>
Selasa, 30 Agustus 2011
[MS_AccessPros] Re: Setting rowsource to a query in code
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar