I am trying to make what is essentially a template for a series of forms. Each form will basically do the same thing but work with a different table. My intention is to have a series of variables to hold the name of the table and fields so that I can easily make each form fit it's specific needs.
Ex:
strTblName - holds the name of the table
strTblField - holds the name of the field
I've gotten everything to work except for an AddNew statement. I cannot come up with the proper code for it.
strAdd = "rstNewData!" & strTblField & " = " & strData
'MsgBox (strAdd)
Set rstNewData = New ADODB.Recordset
rstNewData.ActiveConnection = CurrentProject.Connection
rstNewData.CursorType = adOpenKeyset
rstNewData.LockType = adLockOptimistic
rstNewData.Open "Select * from " & strTblName
rstNewData.AddNew
?????????????????
rstNewData.Update
rstNewData.Close
I've tried a variety of methods but can't seem to find one that works. Any help would be appreciated.
Ex:
strTblName - holds the name of the table
strTblField - holds the name of the field
I've gotten everything to work except for an AddNew statement. I cannot come up with the proper code for it.
strAdd = "rstNewData!" & strTblField & " = " & strData
'MsgBox (strAdd)
Set rstNewData = New ADODB.Recordset
rstNewData.ActiveConnection = CurrentProject.Connection
rstNewData.CursorType = adOpenKeyset
rstNewData.LockType = adLockOptimistic
rstNewData.Open "Select * from " & strTblName
rstNewData.AddNew
?????????????????
rstNewData.Update
rstNewData.Close
I've tried a variety of methods but can't seem to find one that works. Any help would be appreciated.