T
tkeith3556 via AccessMonster.com
I have a number of conditional If...then statements that can be updated or
changed at any time. I was thinking of putting these If...then statements in
a table that could be updated externally without having to change the file
itself. Then cycling through these conditonal statments through code, but I
don't know how to build a VBA statement that would read the If...then
statement as executable code and not just a returned value for a variable.
Has anyone ever tried this or am I way off base.
for example:
Dim cdb As DAO.Database, rs As Recordset, el1 As Variant, sql As String
Dim el2 As String
Set cdb = CurrentDb
If Me.TabCtl248 = 8 Then
sql = "SELECT * From EtblCBOValFunc"
Set rs = cdb.OpenRecordset(sql)
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF = True
el1 = rs!EndValFunc
el2 = rs!EndValFuncDes
'el1 and el2 pulls the conditional statements then passes it to the If...then
statement below
If el1 Then
el2
End If
rs.MoveNext
Loop
Of course that doesn't work because the variables are returned as values and
not executable code.
is there a way to do this?
changed at any time. I was thinking of putting these If...then statements in
a table that could be updated externally without having to change the file
itself. Then cycling through these conditonal statments through code, but I
don't know how to build a VBA statement that would read the If...then
statement as executable code and not just a returned value for a variable.
Has anyone ever tried this or am I way off base.
for example:
Dim cdb As DAO.Database, rs As Recordset, el1 As Variant, sql As String
Dim el2 As String
Set cdb = CurrentDb
If Me.TabCtl248 = 8 Then
sql = "SELECT * From EtblCBOValFunc"
Set rs = cdb.OpenRecordset(sql)
rs.MoveLast
rs.MoveFirst
Do Until rs.EOF = True
el1 = rs!EndValFunc
el2 = rs!EndValFuncDes
'el1 and el2 pulls the conditional statements then passes it to the If...then
statement below
If el1 Then
el2
End If
rs.MoveNext
Loop
Of course that doesn't work because the variables are returned as values and
not executable code.
is there a way to do this?