The problem is: When you set up workgroup security by creating a .mdw file,
this will not work anymore:
Me!combobox.RowSource = "SELECT ShipCity FROM Cities " & _
"IN '' [MS
Access;database=C:\Access\test.mdb;pwd=test] " & _
"ORDER BY [ShipCity]; "
This is because the security needs also the UID etc.., but the 'IN'
statement will not eat uids.
therefore .rowsource is not an option anymore. At least I managed to open a
recordset with this crazy connection string:
Provider=Microsoft.Jet.OLEDB.4.0;Password=test;User ID=UserName;Data
Source=C:\test.mdb;Mode=Share Deny None;Extended Properties="";Jet
OLEDB:System database=C:\Security.mdw;Jet OLEDB:Registry Path="";Jet
OLEDB
atabase Password="";Jet OLEDB:Engine Type=5;Jet OLEDB
atabase Locking
Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk
Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System
Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB
on't Copy Locale
on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet
OLEDB:SFP=False
But how the hell would you do this in an access sql string like above - to
fill up a listbox ?
what a challenge !
Marshall Barton said:
To quote Spock - "Fascinating!"
I've never actually done this in an application, but in
researching your question, I discovered (in AXP) that the
combo box object has a Recordset property. That's a big
surprise to me, so I gave it a try:
Set rs = CurrentDb.OpenRecordset("SELECT . . .")
Set Me.combobox.Recordset = rs
Set rs = Nothing
and, lo and behold, wonders of wonders, it worked just as I
think you want it to.
Now, as to why I never even thought to try this before, I
guess it's because I have never come across a reason to do
this. If you can open a recordset, at least in my
experience, you could also set the combo box's RowSource to
do the same thing. If you do have a good reason for this
odd(?) requirement, I would be very interested in knowing
what it is.