I am unable to filter subform

venu_resoju

Registered User.
Local time
Tomorrow, 00:31
Joined
Dec 29, 2010
Messages
130
I have created one form with subform named "AttendanceLog" but I am unable to do the filter settings. why because I don't thing how to do/set the filter settings and VBA codes. I am here with attaching my DB...please tell me something about filtering the subforms and how to create subform filter settings/VBA codes
 

Attachments

Thanks Mr.PNGBill,

I have learnt and got some filters by your link.

I am getting "Type mismatch" when I am selecting "Last 6 Months" option in my "AttendanceLog" form. Please do the needful. here with attached my database. please give me some solutions.

Thanking you
 

Attachments

Open AttendanceLog form in design mode and go to an event.
Debug, Compile.
Code:
Private Sub Combo10_AfterUpdate()
    Me.txtEmpName = Me.Combo10.Column(1)
    
    Me.txtEPFNo = Me.Combo10.Column(2)
    Me.txtESINo = Me.Combo10.Column(3)
End Sub
You should get a message saying there is no control Combo10

What is the correct name of this combo ??

You need to ompile your code when ever you make any changes and it is a good habit to Compile before closing any VBA screen.
 
What are your queries AttendanceLogQuery and PayrollQuery designed to do ??

When I run them they only return 1 record each ??

When I click Attndance Log on your Attendance form only one record is listed in the combo box ? is this correct or should be all records ??
 
If you want to Link Master Child Fields for your AttendanceLogQuerysubform and attendanceLog main form type cboempname in Link Master Fields and EmpName in Link Child Fields on your subform property sheet, Data fileds.

I suggest you edit your form to include the EmpID on the main form and link that to the subform EmpID. This is a better link then using a last name as surely there will be a possible duplicate record even in a small number of employees.

You don't need the Name to be selected in the main form as it can be handled by DLookup to populate a text box control.
I have made changes to a form to show what I mean - see attached database.
 

Attachments

Please add some text messages to your forms advising what is supposed to happen. Not easy to find errors when the expected outcome is unknown.

When you use sql in your vba code, creat a query first in your database to perform the task you expect your code to perform.
If the query works, then use the sql of that to be the base for your vba sqlString.
This should mean errors will be vba syntax rather then fundemental sql data select issues ie the sql won't supply the result you require.

AttendanceLog form has Month Year From To controls and labels that are hidden until Custom Period is selected.
You have On Click events for the two From text box controls.
I think these should be either After Update or No event at all and you have a command button to click for the event to occur If the two controls have a value.

The On Click Event will Fire as soon as you Click on the control which is before you have entered any data and you presumably require both controls to be updated before the Event takes place, hence my suggestion of a Commend Button. This could be Visible only when both of the controls have a value.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom