I have a form that uses a recordset to add data to a table. I would like to improve it by adding a text box so that the person using the form can choose what table they would like to enter the data into, as this database has multiple table with parallel structure. I can't quite figure out how to work it.
This is what I have currently:
Code:
Set WorkingDB = OpenDatabase("C:\Documents and Settings\Von Fischer Lab\My Documents\WorkingDB.accdb")
Dim rsSurvivorsEntry As Recordset
Set rsSurvivorsEntry = WorkingDB.OpenRecordset("TableOne", dbOpenDynaset)
I have added a "WhatTable" text box to the form, and I would like the code
Code:
Set WorkingDB = OpenDatabase("C:\Documents and Settings\Von Fischer Lab\My Documents\WorkingDB.accdb")
Dim rsSurvivorsEntry As Recordset
Dim Me.WhatTable As String
Set rsSurvivorsEntry = WorkingDB.OpenRecordset("Me.WhatTable", dbOpenDynaset)
To tell the record set to use whatever Table name is written in the "WhatTable" text box. Instead, I get an error message that says "Cannot find Me.WhatTable Table or Query"
What do I need to change to make this work? As always, your help is greatly apreciated
--Evan