giana
01-12-2004, 09:28 AM
Hi everybody, this is my problem for today:
I have a form in vb6 called employees, which gets its data from an access db through an Ado connection. The form has a datacombo, called "Departments", which takes the ID from the Employee table, but the name of the department from the Departments table. It works fine when I browse the employee table through the form, but when I try to add a record I get an erro back: "Consumer's event handler called a non-reentrant method in the provider". Anyone knows what this means?
here's the code for the form_load event and the add event:
Private Sub Form_Load()
On Error GoTo Handler:
Call CenterForm(Me)
ConnectBackend
Dim depRecSet As Recordset
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "SELECT Name,Title,DepartmentID,Address,City,StateorProvince,PostalCode,EmailN ame,HomePhone,SocialSecurityNumber,DateHired,HourlyRate FROM Employees", conData, adOpenStatic, adLockOptimistic
Dim oText As TextBox 'Bind the text boxes to the data provider
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
'Fill the department combobox from the department table and write the user choice in the employees table
Set depRecSet = New Recordset
depRecSet.Open "SELECT DepartmentID, DepartmentName FROM Departments", conData, adOpenStatic, adLockOptimistic
With Me.cmbDepartment
Set .DataSource = adoPrimaryRS
.DataField = "DepartmentID"
.BoundColumn = "DepartmentID"
Set .RowSource = depRecSet
.ListField = "DepartmentName"
.Refresh
End With
mbDataChanged = False
Handler:
Err.Number & Err.Description
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
With adoPrimaryRS
If Not (.BOF And .EOF) Then
mvBookMark = .Bookmark
End If
.AddNew
lblStatus.Caption = "Add record"
mbAddNewFlag = True
SetButtons False
End With
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
thanks a lot
giana
I have a form in vb6 called employees, which gets its data from an access db through an Ado connection. The form has a datacombo, called "Departments", which takes the ID from the Employee table, but the name of the department from the Departments table. It works fine when I browse the employee table through the form, but when I try to add a record I get an erro back: "Consumer's event handler called a non-reentrant method in the provider". Anyone knows what this means?
here's the code for the form_load event and the add event:
Private Sub Form_Load()
On Error GoTo Handler:
Call CenterForm(Me)
ConnectBackend
Dim depRecSet As Recordset
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "SELECT Name,Title,DepartmentID,Address,City,StateorProvince,PostalCode,EmailN ame,HomePhone,SocialSecurityNumber,DateHired,HourlyRate FROM Employees", conData, adOpenStatic, adLockOptimistic
Dim oText As TextBox 'Bind the text boxes to the data provider
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
'Fill the department combobox from the department table and write the user choice in the employees table
Set depRecSet = New Recordset
depRecSet.Open "SELECT DepartmentID, DepartmentName FROM Departments", conData, adOpenStatic, adLockOptimistic
With Me.cmbDepartment
Set .DataSource = adoPrimaryRS
.DataField = "DepartmentID"
.BoundColumn = "DepartmentID"
Set .RowSource = depRecSet
.ListField = "DepartmentName"
.Refresh
End With
mbDataChanged = False
Handler:
Err.Number & Err.Description
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
With adoPrimaryRS
If Not (.BOF And .EOF) Then
mvBookMark = .Bookmark
End If
.AddNew
lblStatus.Caption = "Add record"
mbAddNewFlag = True
SetButtons False
End With
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
thanks a lot
giana