checkboxes

bella

Registered User.
Local time
Today, 21:23
Joined
Jul 31, 2003
Messages
38
Hi ppl,

can someone tell me the correct syntax for saying:

"If checkbox1 is selected" do blah

Else blah...

i read its meant to be somthing like

If chk1.Value = 1 then blah

but, my checkboxes do not bring up the Value property?

Bella

:confused:
 
Hi Rich,

its gives me runtime error 438
Object doesnt support this property or method

when i do that ??

Bella
 
Here's the code:

==============

' Build string to fill in the [Learning Outcomes Connector]


strSQL2 = "SELECT [Learning Practices Connector].SL_ID, [Learning Practices Connector].LP1_ID, " & _
"[Learning Practices Connector].LP2_ID, [Learning Practices Connector].LP3_ID, " & _
"[Learning Practices Connector].LP4_ID " & _
"FROM [Learning Practices Connector];"

Set rstLP = dbs.OpenRecordset(strSQL2)

rstLP.AddNew

' Get next SL_ID for the Learning Practices Connector Table
rstLP!SL_ID = rst!SL_ID

' This is the bit that doesnt work.

If Me.chkOldLP Then
rstLP!LP1_ID = 1
rstLP!LP2_ID = 2
rstLP!LP3_ID = 3
rstLP!LP4_ID = 4

Else:

rstLP!LP1_ID = y1
rstLP!LP2_ID = y2
rstLP!LP3_ID = y3
rstLP!LP4_ID = y4

End If

' Update the loaded recordset to the learning Practices Connector table
rstLP.Update


' Update the loaded recordset to the Subject List table
rst.Update


End Sub
 
If Me.chkOldLP = True Then
where chkOldLP is the name of the control and not the field name
 
whats a control name and wots a field name?

if i right click the checkbox -> properties -> select All -> Name = chkOldLP

is that a control name?

sorry if its a silly question - im very new to vb

Bella
 
bella said:
whats a control name and wots a field name?


Control name: name of an object on your form: (objects: checkbox, textbox, label, etc)

Field name: name of a field in the form's underlying recordsource (that which gets bound to a control)
 
ok, so my control name is chkOldLP

so how come this line wont work for me?

:( :( :(

Bell
 
Because, I'm guessing, that you have the code in a stand alone module as opposed to a form's module.

Is this the case?
 
um, sorry if this is another silly q, but whats a stand alone module and whats a forms module?

i have all this code behind a command button which is on a form...

does that mean nything to you?

:confused:

Bella
 
Okay, that's a form's module.


At what line, precisely, does the error point to?
 
Forget the rest of the code for a minute, just add this to the button
If Me.chkOldLP = True Then
MsgBox"Test true"
Else
MsgBox"Test false"
End If
 
As an aside, I use early binding when using DAO, which is:

rs.Fields("Fieldname")

compared to your

rs!Fieldname


In your case though, shouldn't your field names be surrounded by brackets as they contain the underscore character.
 
Rich

It says Object will not support this method
 
No they aren't bound to a table. (Should they be?) - if so, how do i bind them?

the purpose of my text boxes is if the user selects chk1, one set of values get updated to a table. Otherwise another set of values get updated.



Bella.
 

Users who are viewing this thread

Back
Top Bottom