View Full Version : Code help neede for gender report.


deanwat
11-14-2007, 08:19 AM
I am very new at this. So I'm sure I am far from right, so could some one help. I am trying to create a report that will ask weather you want a female or male report of customers through a input box. What I have is bellow:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim strF As String
Dim strM As String
Dim strGender As String
Dim intButtonPressed As Integer

strGender = InputBox("Enter F for female repot and M for Male report.", 4, "Gender Report")

If strGender = F Then
DoCmd.ApplyFilter "SELECT * FROM tblCustomer WHERE Gender = 'F'"

ElseIf strGender = M Then
DoCmd.ApplyFilter "SELECT * FROM tblCustomer WHERE Gender = 'M'"
End If
End Sub

DCrake
11-26-2007, 06:10 AM
Hi

You need to perform this on the OnLoad property of the form

Code Master::cool: