|
-
Nov 8th, 1999, 04:55 AM
#1
Thread Starter
Hyperactive Member
I have a listbox that is filled with a list of tables from a database. The list changes frequently. I need to be able to take a table that the user selects in the listbox and use it to perform other operations, such as deleting the table. How can I do this, since I can't use a Select Case statement???
------------------
Ryan
[email protected]
ICQ# 47799046
-
Nov 8th, 1999, 05:01 AM
#2
The Name of the Table the User Selects will be Held in the Text Property which is the Default Property for a Listbox, eg.
oRs = oDB.OpenRecordSet("SELECT * FROM " & List1, dbOpenforwardOnly) 'Select All Records From Table Selected in List1
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Nov 8th, 1999, 05:22 AM
#3
Thread Starter
Hyperactive Member
Ok, that will work for opening the table, but if I just need the name that is selected in the listbox, then how would I go about extracting that from VB? Would that just be in the listbox.text property? Is that what you meant by the first part of your reply? Thanks.
------------------
Ryan
[email protected]
ICQ# 47799046
-
Nov 8th, 1999, 05:47 AM
#4
Thread Starter
Hyperactive Member
What I need to be able to do is use the listbox to open another form (say the form name is "frmCustomer"), that has the same name as the table that is selected (when the table name is "Customer"). But I can't figure out how to get the name in the listbox into a .show command. Can you enlighten me? I hope you can. Or possibly show me another way I can accomplish the same thing. If I need to rename the form in order to make it work, that's no big deal. Thanks.
------------------
Ryan
[email protected]
ICQ# 47799046
-
Nov 8th, 1999, 07:14 PM
#5
Create a global variable in the module:
Public g_strTableName As String
Then put this on List1_Click event:
strTableName = List1.List(List1.ListIndex)
Then on the frmCustomers Form_Load event use this variable:
strSQL = "Select * From " & g_strTableName
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-09-1999).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|