Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox query

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi,
On a continous form there is a check box in the Detail Section.
It is used to select a record to input data.The checkbox is a Yes/No.

What is required is that when you go to a new record, that the checkbox on the previous record, becomes unchecked.
The reason is that when the checkbox is, true it will print out that record only. So the requirment is to be able to only print out the record that has been selected.

Thank you
kp
 
If this is in a continous form then the only way this will work if in the underlying table there is a boolean field. If this is an unbound checkbox it will not work?
If you do not want to put a field in the underlying table then consider a multiselect listbox, to pick the records you want to print.

If you want to go with the bound field then please ask a question and be specific. From your post I have no idea what you have tried, what are the relevant tables and fields, what part do you need help with.
 
Hi MajP,
Many thanks for your reply.

1. The check box is bound to the form
2. A multi select list box I have tried but it becomes to untidy for ther user to use.
3.I have not tried any code as I'm just not sure what to use.

Only 1 table is used.
The code for the continous form is as follows:

[blue]SELECT tblpayrecords.SPR, tblpayrecords.StaffID, tblpayrecords.NewR, tblpayrecords.PCNo, tblpayrecords.SLastname, tblpayrecords.SFirstname, tblpayrecords.Postal, tblpayrecords.Day7a, tblpayrecords.Night7a, tblpayrecords.PN7a, tblpayrecords.SAT7a, tblpayrecords.SUN7a, tblpayrecords.PASWKD7a, tblpayrecords.PHOLS7a, tblpayrecords.SDr, tblpayrecords.SNR, tblpayrecords.SSatr, tblpayrecords.SSunr, tblpayrecords.SPhr, tblpayrecords.SPwknR, tblpayrecords.SPwndR, tblpayrecords.PdateFrom, tblpayrecords.PDateto
FROM tblpayrecords
WHERE (((tblpayrecords.StaffID)=[forms]![Form41]![StaffPay_Records].[Form]![StaffID]));[/blue]

The check box is NewR

What is required is that on the continous form the check box appears on each record. So that when the checkbox is checked that record can be printed. If the user wants to say select another record then the previous record is unselected, so that only that selected record will rpint.

many thanks

kp










 
Agree with Duane. But if you had to make it so that only one record could be selected
Code:
Public Sub checkSelected()
  'Before update the record set all records to false.
   Dim strSql As String
   strSql = "UPDATE tblPlayRecords SET tblPlayRecords.NewR = False"
   CurrentDb.Execute strSql
End Sub

Private Sub txtBxNewR_BeforeUpdate(Cancel As Integer)
  checkSelected
End Sub
 
Hi guys,
Many thanks for your replies. This was a part of the database that had an employess pay advice. In the system at present all the pays are generated for the employees.
The problem we have is that once the pays have been added to the system, when it comes to printing them out, it will print all the employees pay records, even the blank ones.

So in the query that drives the employees pay report I added that NewR field. I set the criteria to ""True
so that only the current employees who have been paid will have their reports printed.

Then when the next pay is due the office staff will not print the last pay. Hence having the check box deselected.

The only other way I could think of was to print pay reports by the pay date.

Which is the more professional way of doing this?

kp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top