[AccessD] Create unique tables by groups of records and export to multiple excel tables

Beau Crawford Beau.Crawford at arkansas.gov
Tue Jun 12 13:37:16 CDT 2007



Beau Crawford- GIS Analyst
Arkansas Geographic Information Office
124 West Capitol, Suite 990
Little Rock, AR 72201
501-682-5764 - work
e-mail: beau.crawford at arkansas.gov
www.gis.state.ar.us
www.geostor.arkansas.gov
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Christopher
Jeris
Sent: Tuesday, June 12, 2007 1:29 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Form hangs when setting listbox selected index

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This may be a novice question, but I'm quite confused.

Fully updated Access XP on Windows XP.

I have created a form with a single listbox control, List0.
There is a table Table1 with a single TEXT(50) field field1, and a query
Query1 whose content is SELECT field1 FROM Table1 .

The form's class module has the following content:

Option Compare Database

Private Sub Form_Open(Cancel As Integer)
    Dim qd As DAO.QueryDef
    Dim rs As DAO.Recordset
    Set qd = CurrentDb.QueryDefs("Query1")
    Set rs = qd.OpenRecordset(dbOpenDynaset, dbReadOnly)
    If rs.BOF Then ' no records
        Cancel = True
    Else
        Set Me!List0.Recordset = rs
        Me!List0.Selected(0) = True
    End If
    Set rs = Nothing
    Set qd = Nothing
End Sub

(I know DAO is ancient, but the docs I learned from are all of Access 97
vintage, and I haven't learned how to work ADO yet.  Other DAO code in
this project works fine.)

The problem I observe is that after
        Me!List0.Selected(0) = True
the form hangs: all controls on it become unresponsive.  The form can be
closed normally and Access itself survives.

What I want to do is just highlight the first item in the listbox by
default.  What's going on here?

Thanks,
Chris Jeris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGbuXq5ICCNV0oGWARAuSAAJ9/ub1vUNPqZNK4rzTZPzl35aXnOACfVt1W
3OThlbDJ93d4lQyBafcX0I0=
=kyG4
-----END PGP SIGNATURE-----
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list