A varible question?

message from delolwai on 10 May 2004
Dim a as variant
Dim rst as variant

a = "AddNew"
Set rst = Currentdb.Openrecordset("Table");
rst.(what is the syntax of a for AddNew)???
.................
(p.s: certainly I know simply rst.AddNew is ok...)

I don't know how to explain why I have to do so but I really want to
know is it any possible solution to do it.
Thx so much

Barabus
 
Brendan Reynolds replied to delolwai on 10 May 2004
Public Sub TestCallByName()

Dim strMethod As String
Dim rst As ADODB.Recordset

strMethod = "AddNew"
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open ("SELECT TestText FROM tblTest")

CallByName rst, strMethod, VbMethod

.Fields("TestText").Value = "A Test"
.Update
.Close
End With

End Sub
 

Archived message: A varible question? (Microsoft Access Error Message)