Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a trio of questions... 1

Status
Not open for further replies.

VickyC

Technical User
Sep 25, 2010
206
CA
hello to all

In my application (ms Access 2002), I've got 3 questions that I'm hoping will get answered. I have 'work arounds' for two of these, so this is mainly for my own education:

1)When I use the following, I get error 91 (Object variable or With Object variable not set.) The DAO 3.6 Object Library IS in the list of references.[tt]
Dim db As DAO.Database, rs As recordset
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)[/tt]

But, when I replace the last line by the following, all is OK. [tt]
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset) [/tt]

Why is this?

2) When I use a statement like the following... [tt]
Set rst = CurrentDb.OpenRecordset(strT, dbOpenDynaset, dbReadOnly)[/tt]

... I'm unable to use a statement like rst!V1.Delete. (I'm guessing this is because of the 'dbReadOnly'.) But, I can still run execute a DELETE query successfully. Why is this?

3) I have a listbox with a horizontal scrollbar that I don't want or need. The sum ot the column widths is less than the control's width, so why is this happening? When I've Googled this, there are many proposed solutions that seem to center on making the listbox wider than the column widths, but this is not true in my case. Any thoughts?

many thanks
Vicky C.
 
Code:
Dim db As DAO.Database, rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

2) The recordset is read only, not the underlaying query/table

3) Did you try its SizeToFit method ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks PHV - the 1st two points are clear. Re the listbox, I haven't tried SizeToFit. I'm not even sure this is available in Access 2002? I can't figure out how to adapt this to the listbox.

thanks, Vicky C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top