Expand|Select|Wrap|Line Numbers
- Private Sub Form_Open(Cancel As Integer)
- Dim rs As Recordset
- Set rs = CurrentDb.OpenRecordset("SELECT * from tblTest1")
- Set Me.Recordset = rs
- Me.txtDiscipline.ControlSource = "Discipline"
- End Sub
This works. However, when I try to create an InputBox to allow the user to select the specific table, It doesn't work. Sample code below. What am I doing wrong?
---------------------------
Expand|Select|Wrap|Line Numbers
- Private Sub Form_Open(Cancel As Integer)
- Dim tblFile As String
- Dim rs As Recordset
- tblFile = InputBox("Enter the name of the Project File ex. tbl_FileName")
- If Len(tblFile) = 0 Then
- MsgBox ("No Project File name was specified")
- Exit Sub
- End If
- Set rs = CurrentDb.OpenRecordset("SELECT * from tblFile")
- Set Me.Recordset = rs
- Me.txtDiscipline.ControlSource = "Discipline"
- End Sub