flaviooooo
Programmer
Hi,
I have a form that's giving me a headache. On top there is a combobox, containing all orders. Now when I select an order, the form would be filled with the data of that order.
Unfortunately, things don't seem to be so simple. I have to select an order up to 4 times before it actually gives me all the data. The other times it gives me the error 2001 - you canceled the previous operation.
The code looks like this:
Private Sub cmbSelectedOrder_AfterUpdate()
On Error GoTo Catch
Dim intParameterFieldNr As Integer
Dim strParameterList As String
Dim rsEnquiry As ADODB.Recordset
Dim cTrL As Control
Try:
If Me.Dirty Then
'Save Record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
'* Clear the preview screen
O_Preview.Value = Nothing
'* Display the Name of the client
txtSelectedKlant.Value = cmbSleutel.Column(2)
'* Lookup and display the correct record for the selected order
Set rsEnquiry = Me.RecordsetClone
With rsEnquiry
rsEnquiry.Find "OrderID='" & Me.cmbSelectedOrder.Value & "'"
If rsEnquiry.EOF Then
MsgBox "Order bestaat niet.", vbOKOnly + vbExclamation
GoTo finally
Else
Me.Bookmark = rsEnquiry.Bookmark
End If
End With
finally:
Set rsEnquiry = Nothing
Exit Sub
Catch:
moGeneral.HandleError Err.Number, Err.Description, Me.Name & ".cmbSelectedOrder_AfterUpdate"
Resume finally
End Sub
The code gives me the error on line
Me.Bookmark = rsEnquiry.Bookmark
Any ideas what could be the problem?
I have a form that's giving me a headache. On top there is a combobox, containing all orders. Now when I select an order, the form would be filled with the data of that order.
Unfortunately, things don't seem to be so simple. I have to select an order up to 4 times before it actually gives me all the data. The other times it gives me the error 2001 - you canceled the previous operation.
The code looks like this:
Private Sub cmbSelectedOrder_AfterUpdate()
On Error GoTo Catch
Dim intParameterFieldNr As Integer
Dim strParameterList As String
Dim rsEnquiry As ADODB.Recordset
Dim cTrL As Control
Try:
If Me.Dirty Then
'Save Record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
'* Clear the preview screen
O_Preview.Value = Nothing
'* Display the Name of the client
txtSelectedKlant.Value = cmbSleutel.Column(2)
'* Lookup and display the correct record for the selected order
Set rsEnquiry = Me.RecordsetClone
With rsEnquiry
rsEnquiry.Find "OrderID='" & Me.cmbSelectedOrder.Value & "'"
If rsEnquiry.EOF Then
MsgBox "Order bestaat niet.", vbOKOnly + vbExclamation
GoTo finally
Else
Me.Bookmark = rsEnquiry.Bookmark
End If
End With
finally:
Set rsEnquiry = Nothing
Exit Sub
Catch:
moGeneral.HandleError Err.Number, Err.Description, Me.Name & ".cmbSelectedOrder_AfterUpdate"
Resume finally
End Sub
The code gives me the error on line
Me.Bookmark = rsEnquiry.Bookmark
Any ideas what could be the problem?