Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Hi,
Dynamic list boxes is a useful topic and one I got hung up on a
little in attempting to show "AllTables", using the CurrentProject class rather than CurrentData. Although I was successful in listing all the tables for the users, I have system tables like MSysAccessObjects,MSysACEs, MSsyqueries, etc. that I would like to exclude. How can I exclude these from the dynamic list? My coding is:
Private Sub Form_Load()
Dim objAO As AccessObject
Dim objCP As Object
Dim sValues As String
Set objCP = Application.CurrentData
For Each objAO In objCP.AllTables
sValues = sValues & objAO.Name & ";"
Next objAO
By using a naming convention for your tables, such as tbl in front of all table names, you could use and if/then statement and parse out the table names.
Bob, thanks! I mean - thank's a lot! That's great. It looks like I went around the issue the long way. I see the logic but am not sure what Type=1 is or what the ,1,4 is for.
You realy helped a lot and I appreciate it.
Thanks again,
Sean
Mid([name],1,4) means "give me the first four characters of the object name starting at the first character." See the Mid Function in the helpful VBA help file which is accessed from the VBA editor menu (not the "unhelpful" Access help file which is accessed from the Access menu).
Quote:
quote:Bob, opened MSysObjects and see it all clear now.
quote:opened MSysObjects and see it all clear now.
because I opened the MSysObjects table and saw [name] field where this holds the string of the tables to list excluding if the first 4 characters are 'MSys' and the [type] field = 1. I am a beginning VBA programmer and when I saw this, it was clear as to why the code is written as it is.
I have been getting better at intuitively writing the code, but some things just aren't that easy. I have another posting regarding tickle reports. This is one topic I have not really seen in the Wrox VBA collection.
I see. I was just a little worried that you had somehow opened up MSysObjects and inadvertantly deleted its contents. I'd recommend leaving your system tables hidden and never open them directly. No reason to. Better to just query them if you want to access their contents. Deleting something could wreck your db.
Bob, The system tables are protected an I don't think I can delete them. Yet, you're right it's probably not a terrific idea to be opening them. That is one of the reasons I wanted them to be removed from the dynamic list box. Now the users can't inadvertantly open the system tables.
If you have any suggestions on where I should start in developing the scheduling logic for a db, I could definately use some suggestions. I posted "tickle reports"
I have a Contacts Management database that is based on one of the sample databases of the same name that shipped with (I think) A2K (maybe 97). This database uses tickler functionality to launch a 'Reminder' form when the db opens to display reminders regarding contact follow-up issues (Action Items). It uses an ocx Calendar control to set the tickler date. The functionality is too involved to post (three forms with a bunch of code are used) but you can download a copy (I think) from the Microsoft downloads site. Just look for a database named 'Contact Management' under the availabe Access downloads.