coding problem

A

Afrosheen

I believe I have some drain bamage. I'm trying to code a section where if
this item is true in table 1 then add a check to a field in table 2. Here's
the code

Private Sub trainer_Click()
If trainer = True Then
Me.tbl_training [check] = True
Else
Me.tbl_training [check] = False
End If
End Sub

The trainer field is in the active table called roster.

Thanks for the help
 
J

John W. Vinson

I believe I have some drain bamage. I'm trying to code a section where if
this item is true in table 1 then add a check to a field in table 2. Here's
the code

Private Sub trainer_Click()
If trainer = True Then
Me.tbl_training [check] = True
Else
Me.tbl_training [check] = False
End If
End Sub

Several major issues here.

A Table could have (say) 328854 records. Which record do you want to update?

A Form is not a Table. A Checkbox ia a control on a form. A Yes/No field can
be a field in a table.

Nowhere do you define what "trainer" is. Access will assume that it is an
undeclared VBA variable (of Variant datatype, NULL value if you don't specify
otherwise). What do you intend "trainer" to mean?

You're apparently trying to store data redundantly. If the value of the field
Check in tblTraining will always be equal to the value of Trainer, you
probably shouldn't be storing it at all; just use a query joining the tables
to find it.

What's the context? What's the recordsource of the Form? What two tables do
you have, and how are they related?
 

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