Requerying Combos crashes access

V

Vantastic

I have 4 combos which I need to re-query in the OnCurrent event. The reason
for this is so I can get a listcount for each of them, an update
Toggle.Captions with a string value (ie. toggle1.caption = "String" &
combo1.listcount")

When the On Current even occurs, Access crashes out, however I've put the
same code into a command button, and when a user clicks it, it does what its
supposed to do. I've even tried calling that command button code in the on
current even, only to have access crash again.

There are 4 toggle buttons which I use to change the rowsource on a listbox
on my form.

Any idea why this would be happening? The four combos use the same select
queries as when each toggle button is pressed. I've simplified them
dramatically so they only call results from one table and still the problem
occurs. I'm at a loss as to why?

For your reference, the code is below, erroneous parts prefixed with '

TIA



Private Sub Form_Current()

On Error GoTo ProbablyStatusBarError

'cmbTrainingAll.Requery
'cmbTrainingCurrent.Requery
'cmbTrainingExpired.Requery
'cmbTrainingSuperceded.Requery

'Toggle25.Caption = "All - " & cmbTrainingAll.ListCount
'Toggle26.Caption = "Current - " & cmbTrainingCurrent.ListCount
'Toggle27.Caption = "Expired - " & cmbTrainingExpired.ListCount
'Toggle28.Caption = "Superceded - " & cmbTrainingSuperceded.ListCount



If Frame22.Value = 1 Then
List88.RowSource = "Training - All"
ElseIf Frame22.Value = 2 Then
List88.RowSource = "Training - Current"
ElseIf Frame22.Value = 3 Then
List88.RowSource = "Training - Expired"
ElseIf Frame22.Value = 4 Then
List88.RowSource = "Training - Superceded"
Else:
End If

StatusBar2.Visible = True

Form_Employees!StatusBar2.Panels(1).Text = "Logged in as: " & CurrentUser &
" "

Form_Employees!StatusBar2.Panels(2).Text = "Employee: " & FirstName.Value &
" " & LastName.Value & " "
Form_Employees!StatusBar2.Panels(3).Text = "Employees on File: " &
DCount([EmployeeID], "Employees") & " "

Form_Employees!StatusBar2.Panels(4).Text = "Created " & Format(CreatedOn,
"Short Date") & " by " & CreatedBy.Value & " "
Form_Employees!StatusBar2.Panels(4).ToolTipText = "Detailed Time: " &
CreatedOn.Value

Form_Employees!StatusBar2.Panels(5).Text = "Modified " & Format(ModifiedOn,
"Short Date") & " by " & ModifiedBy.Value & " "
Form_Employees!StatusBar2.Panels(5).ToolTipText = "Detailed Time: " &
ModifiedOn.Value

Form_Employees!StatusBar2.Panels(6).Text = Format(Date, "Long Date")

If OnSite.Value = -1 Then
Box75.Visible = True
Else:
Box75.Visible = False
End If

If Note.Value > "" Then
Notes.Caption = "Notes*"
Notes.ControlTipText = "There are notes for this employee"
Else:
Notes.Caption = "Notes"
Notes.ControlTipText = ""
End If


ProbablyStatusBarError:
If Err.Number = 0 Then
Exit Sub
Else:
MsgBox Err.Description & Chr(10) & Err.Number
Exit Sub
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top