Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2013, 12:39 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default tables and fields listboxes

I am using a form with two list boxes to provide the user with query building tools. The form should list the tables(lstbx1) and the fields(lstbx2) and allow user to make selections thus creating a query.
As simple as it should be, I cannot get lstbx2 to list the fields from a table selected in lstbx1.

I have this on Form load:
Private Sub Form_Load()
Dim db As Database, tbl As TableDef
Set db = CurrentDb

For Each tbl In db.TableDefs
If Left$(tbl.Name, 4) <> "MSys" And Left$(tbl.Name, 5) <> "VALID" Then
lstTables.RowSource = tbl.Name & "; " & lstTables.RowSource
End If
Next
End Sub

But I get a null error when I select a table name from list 1

Any ideas would be greatly appreciated!
 
Old August 2nd, 2013, 08:03 AM
Registered User
Points: 9, Level: 1
Points: 9, Level: 1 Points: 9, Level: 1 Points: 9, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am confused why this is happening.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare two fields from different tables pallone SQL Server 2000 10 March 23rd, 2007 05:14 PM
Listboxes Sub-Listboxes and Table Linking MJB05 Access 4 September 20th, 2005 12:37 PM
Blank fields - queries with many tables dvarrin Crystal Reports 0 February 1st, 2005 05:43 AM
Pooling fields from two tables into one view eoffshore SQL Language 4 August 2nd, 2004 05:42 AM
fields from tables to update damnnono_86 Access 3 November 5th, 2003 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.