Hi Everybody,
I am using Alan Brownes Example of a search form example and I keep getting an error of the following:-
Enter Parameter Value Msg Box with the entered Value "Mar" and I re-enter "Mar" the value is displayed. Then the query works.
I don't know why this msg box keeps on displaying. Hopefully somebody can help me with this.
A bit more info down below.....
Ive created a table that stores family and friends details, and within the search form is a textbox to enter name, and a combo box for Month which has list values from Jan to Dec.
When I pick any month on the combo box and press the filter button it should display the records within the month.
I have a select query that stores the birthday and takes out the month of the birthday which is:-
and the filter click code as like Allen Brownes
Sorry for the long spool, thought I would detail it as much as possible. Any help would be again greatly appreciated.
Man chun
I am using Alan Brownes Example of a search form example and I keep getting an error of the following:-
Enter Parameter Value Msg Box with the entered Value "Mar" and I re-enter "Mar" the value is displayed. Then the query works.
I don't know why this msg box keeps on displaying. Hopefully somebody can help me with this.
A bit more info down below.....
Ive created a table that stores family and friends details, and within the search form is a textbox to enter name, and a combo box for Month which has list values from Jan to Dec.
When I pick any month on the combo box and press the filter button it should display the records within the month.
I have a select query that stores the birthday and takes out the month of the birthday which is:-
Code:
SELECT tblPerson.ContactID, [Firstname]+" "+[Lastname] AS [Full Name], Int((Now()-tblPerson!birthdate)/365.25) AS Age, IIf(IsNull([Birthdate]),"",Format([Birthdate],"mmm")) AS BMonth, tblPerson.Birthdate, DatePart("m",[BirthDate]) AS Expr1, DatePart("d",[Birthdate]) AS Expr2, Format(Date(),"yyyy") AS CurrentYear, IIf(IsNull([birthdate]),"",[SplitDOB] & "/" & [CurrentYear]) AS CurrentDOB, Format([Birthdate],"dd/mm") AS SplitDOB, IIf([CurrentDOB]="","", DateDiff("d",Date(),[CurrentDOB])) AS DaysToDOB, IIf [DaysToDOB]="","DOB Not Given",IIf([DaysToDOB]=0,"Birthday Today",IIf([DaysToDOB]<0,"Birthday has passed","Birthday still to come"))) AS BirthdayStatus FROM tblPerson WHERE (((tblPerson.Birthdate) Is Not Null)) ORDER BY DatePart("m",[BirthDate]), DatePart("d",[Birthdate]);
Code:
Private Sub cmdFilter_Click() Dim strWhere As String Dim lngLen As Long Const conJetDate = "\#mm\/dd\/yyyy\# 'Another text field example. Use Like to find anywhere in the field. If Not IsNull(Me.txtFilterFullName) Then strWhere = strWhere & "([Full Name] Like ""*" & Me.txtFilterFullName & "*"") AND " End If 'Month field example. Do not add the extra quotes. If Not IsNull(Me.cboFilterMonth) Then strWhere = strWhere & "([BMonth] = " & Me.cboFilterMonth & ") AND " End If '*********************************************************************** 'Chop off the trailing " AND ", and use the string as the form's Filter. '*********************************************************************** 'See if the string has more than 5 characters (a trailng " AND ") to remove. lngLen = Len(strWhere) - 5 If lngLen <= 0 Then 'Nah: there was nothing in the string. MsgBox "No criteria", vbInformation, "Nothing to do." Else strWhere = Left$(strWhere, lngLen) 'Finally, apply the string as the form's Filter. Me.Filter = strWhere Me.FilterOn = True End If End Sub
Man chun
Comment