M
MF Scheetz
I was wondering if there was a way to use an if statement to change an ado
field name that is to be updated similar to the following:
Dim FieldNm as String
Dim cn as ADODB.Connection
Dim rsTable as ADOBD.Recordset
Set cn = Currentproject.connection
set rsTable = new adodb.recordset
rsTable.Open "SELECT * FROM TableName",cn, adOpenDynamic, adLockOptimistic
IF Variable = True Then
FieldNm = Field1
ELSEIF Variable = False then
FieldNm = Field2
endif
rsTable.addnew
rsTable.fields('"& FieldNm &"') = 2
rsTable.update
rsTable.close
cn.close
Any help is greatly appreciated.
field name that is to be updated similar to the following:
Dim FieldNm as String
Dim cn as ADODB.Connection
Dim rsTable as ADOBD.Recordset
Set cn = Currentproject.connection
set rsTable = new adodb.recordset
rsTable.Open "SELECT * FROM TableName",cn, adOpenDynamic, adLockOptimistic
IF Variable = True Then
FieldNm = Field1
ELSEIF Variable = False then
FieldNm = Field2
endif
rsTable.addnew
rsTable.fields('"& FieldNm &"') = 2
rsTable.update
rsTable.close
cn.close
Any help is greatly appreciated.