jt463
IS-IT--Management
- Nov 23, 2005
- 134
I want to just use one form and store a table name in an invisible field so I don't have to create many different forms.
In other words, I have Form1 with InvisField (which stores the name of the table that I want to submit the records to). So if I have Table1 in the InvisField, I am trying to figure out the VB that will allow me to change the SQL to look at the InvisField data and open that table accordingly.
This is what I have:
Basically, I am trying to figure out how I can pass the table name from the form to the select statement.
Any help would be greatly appreciated!
In other words, I have Form1 with InvisField (which stores the name of the table that I want to submit the records to). So if I have Table1 in the InvisField, I am trying to figure out the VB that will allow me to change the SQL to look at the InvisField data and open that table accordingly.
This is what I have:
Code:
Dim tbldb as DAO.Database
Dim tblrst as DAO.Recordset
Dim TableString As String
TableString = Me.InvisField.Value
Set tbldb = CurrentDb
Set tblrst = tbldb.OpenRecordset("select * from '" & TableString & "' WHERE ...")
Basically, I am trying to figure out how I can pass the table name from the form to the select statement.
Any help would be greatly appreciated!