Checkbox event

M

Mark

Hi,
I'm used to developing C++ code with Visual Studio and had a little ADO
programming in VB before, but now a friend has asked me to modify an
existing database. Several checkboxes need to be placed on a form that when
checked, update a field in a particular record in a different table. I
havent done any access programming before. I'm having trouble sifting
through the mass of completely beginner access information, to that way
above my head.
When the checkbox beside Monday is ticked, I need to mark it as a bank
holiday. The table DaysofWeek has 3 fields: index, dayName and
IsBankHoliday. However the form the checkbox is on, isnt displaying the
record for the Monday record in the DaysOfWeek.
I'm sure this is simple stuff to you access gurus. Can anyone give me a few
clues what to look for?

Also, in the report, I need to multiply the number of hours worked by 2 if
this field is checked for this day.

thanks for any pointers/advice/sample code,

Mark.
 
K

Ken Ismert

Mark,

The checkbox has a Click event, which is the one you want to use. I
don't know the C++ representation, but in VB the event looks like:

Public Sub chkIsBankHoliday_Click()
' your code here
End Sub

You may not need to do anything: if your form has a Query name or SQL
statement in its RecordSource property, and the ControlSource property
of the checkbox has IsBankHoliday as its field name, it will
automatically update the underlying field value when the user ticks it.

As for Monday not showing, check the Filter property for the Form. If
there is text there, clear it out. The underlying query can also have
its Filter set, or be excluding Mondays in the Where clause.

In your report's underlying query, you can include a calculated field
in the query grid, like:
AdjHours: IIf([IsBankHoliday] = True, [Hours] * 2, [Hours])
The SQL clause would render as:
..., IIf([IsBankHoliday] = True, [Hours] * 2, [Hours]) AS AdjHours,
....

-Ken
 

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