PDA

View Full Version : If...Then Execute Command



aabnormal
09-03-2008, 09:19 AM
Hello all,

I am attempting to run an If.. Then statement that results in the execution of a Command. I keep getting numerous errors however I try this - I am hoping this is possible - I coudl really use any assistance - Thanks


Dim UpdCommand As ADODB.Command

With UpdCommand
.CommandText = SQLstrg
.CommandType = adCmdText
.Execute
End With

For Each UpdateCell In UpdateRange
If IsEmpty(UpdateCell) = False Then 'execute UpdCommand Here
End With
Next UpdateCell

Bob Phillips
09-03-2008, 09:21 AM
Guessing somewhat



Dim UpdCommand As ADODB.Command

With UpdCommand
.CommandText = SQLstrg
.CommandType = adCmdText
.Execute
End With

For Each UpdateCell In UpdateRange
If Not IsEmpty(UpdateCell.Value) Then 'execute UpdCommand Here
End With
Next UpdateCell

aabnormal
09-03-2008, 09:29 AM
OK I guess that is a way to write the conditional statement though my real probelm is the syntax for executing the Updcommand if is use DoCmd.Updcomand or Updcommand.execute I get Errors.

Thanks