M
Maury Markowitz
Here's some increadibly simple code that doesn't work. When it runs, I get a
"Multiple-step {something} generated errors". All it does is set a few bits
of data, then calls a general purpose function to update the display a
little.
These are the only two functions that get called. It crashes in
SetBackgroundColor, when it attempts to read tradeType. I don't see how this
could be an error!
Private Sub DeleteButton_Click()
Application.Echo False
Dim currentOrder As adodb.Recordset
Set currentOrder = Me.Recordset
If currentOrder.EOF = True Or currentOrder.BOF = True Then GoTo ExitOut
If currentOrder("status") <> "Entered" Then
DoCmd.Beep
Else
currentOrder.CancelUpdate
currentOrder("status") = "Deleted"
currentOrder("lastModifiedTimestamp") = Time
currentOrder("lastModifiedById") = GetLoggedInUserId()
currentOrder.Update
End If
ExitOut:
Set currentOrder = Nothing
Call SetBackgroundColor
Application.Echo True
End Sub
Public Sub SetBackgroundColor()
Dim currentOrder As adodb.Recordset
Set currentOrder = Me.Recordset
If currentOrder.EOF Or currentOrder.BOF Then
Me.FormBackgroundColorbox.BorderColor = -2147483640
Me.FormBackgroundColorbox.BackColor = -2147483640
Me.FormBackgroundColorbox.BackStyle = Transparent
ElseIf currentOrder("tradeType") = "Sell" Or currentOrder("tradeType") =
"Sell Short" Then
Me.FormBackgroundColorbox.BorderColor = 12615935
Me.FormBackgroundColorbox.BackColor = 12615935
Me.FormBackgroundColorbox.BackStyle = Normal
Else
Me.FormBackgroundColorbox.BorderColor = 16777164
Me.FormBackgroundColorbox.BackColor = 16777164
Me.FormBackgroundColorbox.BackStyle = Normal
End If
Set currentOrder = Nothing
End Sub
"Multiple-step {something} generated errors". All it does is set a few bits
of data, then calls a general purpose function to update the display a
little.
These are the only two functions that get called. It crashes in
SetBackgroundColor, when it attempts to read tradeType. I don't see how this
could be an error!
Private Sub DeleteButton_Click()
Application.Echo False
Dim currentOrder As adodb.Recordset
Set currentOrder = Me.Recordset
If currentOrder.EOF = True Or currentOrder.BOF = True Then GoTo ExitOut
If currentOrder("status") <> "Entered" Then
DoCmd.Beep
Else
currentOrder.CancelUpdate
currentOrder("status") = "Deleted"
currentOrder("lastModifiedTimestamp") = Time
currentOrder("lastModifiedById") = GetLoggedInUserId()
currentOrder.Update
End If
ExitOut:
Set currentOrder = Nothing
Call SetBackgroundColor
Application.Echo True
End Sub
Public Sub SetBackgroundColor()
Dim currentOrder As adodb.Recordset
Set currentOrder = Me.Recordset
If currentOrder.EOF Or currentOrder.BOF Then
Me.FormBackgroundColorbox.BorderColor = -2147483640
Me.FormBackgroundColorbox.BackColor = -2147483640
Me.FormBackgroundColorbox.BackStyle = Transparent
ElseIf currentOrder("tradeType") = "Sell" Or currentOrder("tradeType") =
"Sell Short" Then
Me.FormBackgroundColorbox.BorderColor = 12615935
Me.FormBackgroundColorbox.BackColor = 12615935
Me.FormBackgroundColorbox.BackStyle = Normal
Else
Me.FormBackgroundColorbox.BorderColor = 16777164
Me.FormBackgroundColorbox.BackColor = 16777164
Me.FormBackgroundColorbox.BackStyle = Normal
End If
Set currentOrder = Nothing
End Sub