toggle buttons - stuck event

gadjet

Registered User.
Local time
Today, 18:44
Joined
Jan 21, 2008
Messages
45
Hi, Ive got a form with a list box and I redifine the rowsource in VBA using several toggle buttons. Everything worked fine then all of a sudden when any 3 (same 3) of the 5 toggle buttons were used the form would no longer work. When ever any area on the form or toggle button was pressed the last toggle button event used just repeated with every click. Has anyone seen this before, I've tried repairing the database and restarting the PC but with no improvement. I can post some code if needed. Cheers.
 
if you end up with a form with no records selected, and allow additions false, then you can get funny behaviour - including apparently unresponsive controls - is this a possibility?
 
Hi, Thanks for replying, there are records for each query and they were working when I added them. This one works: Private Sub Toggle5_Click() ' Laptops Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] WHERE ((([PC Details].[PC Type]) = 'laptop'));" Me.List0.Selected(1) = True Me.Toggle6 = False Me.Toggle7 = False Me.Toggle8 = False Me.Toggle11 = False End Sub This one screws up the form: Private Sub Toggle7_Click() 'Workstations Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] WHERE ((([PC Details].[PC Type]) = 'workstation'));" Me.List0.Selected(1) = True Me.Toggle5 = False Me.Toggle6 = False Me.Toggle8 = False Me.Toggle11 = False End Sub
 
OUCH! a bit of formatting might make it easier to read (not to mention CODE tags):

Code:
Private Sub Toggle5_Click() 
' Laptops 
Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname _
FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] _
WHERE ((([PC Details].[PC Type]) = 'laptop'));" 
   Me.List0.Selected(1) = True 
   Me.Toggle6 = False 
   Me.Toggle7 = False 
   Me.Toggle8 = False 
   Me.Toggle11 = False 
End Sub
This one screws up the form:
Code:
Private Sub Toggle7_Click() 
'Workstations 
Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] _
WHERE ((([PC Details].[PC Type]) = 'workstation'));" 
   Me.List0.Selected(1) = True 
   Me.Toggle5 = False 
   Me.Toggle6 = False 
   Me.Toggle8 = False 
   Me.Toggle11 = False 
End Sub

codetag001.png
 
Hi,
Sorry for the terrible post, I didn't preview it and I couldn't get the code working, I realised I'd not enabled the javascript for the site. (new PC)

I hope this is better, this code stops the form from operating.

Code:
Private Sub Toggle7_Click() ' Filter on workstaions only in listbox
Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] WHERE ((([PC Details].[PC Type]) = 'workstation'));"
Me.List0.Selected(1) = True
Me.Toggle5 = False
Me.Toggle6 = False
Me.Toggle8 = False
Me.Toggle11 = False
End Sub
I'm Going to try replacing the toggle with normal buttons, this is the first time I've used toggles!

This code works fine: -

Code:
Private Sub Toggle5_Click() ' Laptops
Me.List0.RowSource = "SELECT [PC Details].ID, [PC Details].[PC ID], [PC Details].[PC Type], [PC Details].[SAP No], alphalist.first_name, alphalist.Surname FROM alphalist INNER JOIN [PC Details] ON alphalist.[SAP No] = [PC Details].[SAP No] WHERE ((([PC Details].[PC Type]) = 'laptop'));"
Me.List0.Selected(1) = True
Me.Toggle6 = False
Me.Toggle7 = False
Me.Toggle8 = False
Me.Toggle11 = False
End Sub

Thanks for helping
 

Users who are viewing this thread

Back
Top Bottom