Unanswered: Select All using checkbox from MSaccess
hi i'm having difficulties solving this problem. i'm trying to make a list of person using a continuous form which has a check box in it, to select the person i want, i will filter the data using their office,year hired, age, and name.
to be able to give them an invitation, the user will check the checkbox for the person and uncheck if not. because the data has many records i'd like to filter the data using the following criteria that i mentioned. if i check the "Select All" checkbox, the checkbox on the filtered data will be selected. and if i uncheck it, the checkbox on the filtered data will be deselected.
sorry if i can't explain it briefly but i really need your help!
many tenks in advance.
PS. do you have example for this? it will be a great help ;-)
first of all, sorry i forgot to tell you that i'm not a programmer. so, kinda bit slow. please bear some patience with me.
in my emp_inv table(name,age,years,office,inv)
inv data type is yes/no (checkbox). everytime you filter a list of data, all in the fields are locked except for the inv which is the checkbox.
i'm using only 1 form, the list of data is shown in the detail section (set to continuous form). In the form header i put 3 combo boxes(age,office,year) and text box(names) for the criteria and a command button to start searching.
i found a sample program on the internet regarding listing and filtering of data. that's why i put it in my program and it worked. here 's the code:
Private Sub cmdFilter_Click()
Dim strwhere As String
Dim lngLen As Long
If Not IsNull(Me.txtname) Then
strwhere = strwhere & "([Name] Like ""*" & Me.txtname & "*"") AND "
If Not IsNull(Me.cboYears) Then
strwhere = strwhere & "([years] = " & Me.cboYears & ") and "
If Not IsNull(Me.cboage) Then
strwhere = strwhere & "([age] = """ & Me.cboage & """) AND "
If Not IsNull(Me.cbooffice) Then
strwhere = strwhere & "([office] = """ & Me.cbooffice & """) AND "
lngLen = Len(strwhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
strwhere = Left$(strwhere, lngLen)
Me.Filter = strwhere
Me.FilterOn = True
now, i really don't know how to put the "Select All" checkbox.
help me please, i just want to finish this project. tnx
Start by putting an unbound checkbox in the header. Then on the click event of that checkbox build and run an update SQL string (see Martin Green's six part lecture for help on that if you need). Tip: Use your form's filter string as the WHERE clause for you query.
It might be a little late, but you may also want to think about changing your field names to be something a little more specific, as I know that Name and Year are Reserved Words in Access. Tip: I name all my fields starting with "fld", so like "fldName", "fldYear", etc.