Hi, All!
I have a VBA code that run various macros based on the field values[FIELD1] in TBL1:
Sub chkappend()
Dim db As Database
Dim rst As Recordset
Dim intF1 As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("TBL1"
intF1 = rst.RecordCount
If intF1 = 0 Then
MsgBox ("No need to update."
Else
Select Case rst![FIELD1]
Case Is = "AA"
DoCmd.RunMacro ("Mcr1.AA"
Case Is = "BB"
DoCmd.RunMacro ("Mcr1.BB"
End Select
End If
When all the criteria are met, only the first case statement was executed, i.e. only Mcr1.AA was run, and the Mcr1.BB was ignored even [Field1] has a value = "BB".
Basically, I need to read throught TBL1. If [FIELD1]="AA", run Mcr1.AA, if = "BB", run Mcr1.BB. And this VBA code is part of my AutoExec job. So, it won't tight with with any controls in the form or report.
What did I do wrong? Thank you for your time and help.
I have a VBA code that run various macros based on the field values[FIELD1] in TBL1:
Sub chkappend()
Dim db As Database
Dim rst As Recordset
Dim intF1 As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("TBL1"
intF1 = rst.RecordCount
If intF1 = 0 Then
MsgBox ("No need to update."
Else
Select Case rst![FIELD1]
Case Is = "AA"
DoCmd.RunMacro ("Mcr1.AA"
Case Is = "BB"
DoCmd.RunMacro ("Mcr1.BB"
End Select
End If
When all the criteria are met, only the first case statement was executed, i.e. only Mcr1.AA was run, and the Mcr1.BB was ignored even [Field1] has a value = "BB".
Basically, I need to read throught TBL1. If [FIELD1]="AA", run Mcr1.AA, if = "BB", run Mcr1.BB. And this VBA code is part of my AutoExec job. So, it won't tight with with any controls in the form or report.
What did I do wrong? Thank you for your time and help.