|
-
Nov 20th, 2008, 05:56 AM
#1
Thread Starter
Lively Member
events do not fire
hi everyone. im looking for some help. when i programatically set a value for a control (ie, check a check box) why doesnt the associated event fire?
for example, if i programatically set checkboxA to checked, the checkbox will become checked but the onclick event doesnt fire. how do i get it to do this.
im creating a set of forms in access 2003
I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base
-
Nov 20th, 2008, 07:13 AM
#2
Re: events do not fire
How are you setting to be checked?
-
Nov 20th, 2008, 07:40 AM
#3
Thread Starter
Lively Member
Re: events do not fire
im pulling data from a table (which i use to store the state of each control) then, put all the data into an array (theres about 50-200 controls on each form) then use somethings like this to set the controls value:
Code:
Function FillForm1(ByRef getarray As Variant)
On Error GoTo errorhandler
Dim i As Integer
For i = 0 To 185
'Debug.Print "question number: " & Forms("frmSection1").Controls("Q" & Format(i, "000")).Name & " answere: " & getarray((i + 1), 0)
Forms("frmSection1").Controls("Q" & Format(i, "000")).Value = getarray((i + 1), 0)
Next i
errorhandler:
If Err.Number = 0 Then
Else
MsgBox Err.Description
End If
End Function
this does set the value for each control but it does not cause the associated event to fire. so, it may check the check box, but if that checkbox event was suppose to enable/disable another control based on the value, it does not happen
I am using Microsoft Visual Basic 2008 Express Edition. I use Access for my data base
-
Nov 20th, 2008, 08:50 AM
#4
Re: events do not fire
Just call the sub...
eg
Code:
chkClickMe=true
chkClickMe_Click
50-200 controls!!
I think you might want to consider a different way
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Nov 20th, 2008, 09:10 AM
#5
Re: events do not fire
What are the names of the checkboxes... give a few examples....
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Nov 20th, 2008, 03:46 PM
#6
Re: events do not fire
Forms("frmSection1").Controls("Q" & Format(i, "000")).Value = getarray((i + 1), 0)
what is the value of getarray at this point?
the checkbox click event will only fire if the value is changed
Last edited by westconn1; Nov 20th, 2008 at 03:55 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|