Hi,
I am trying to error catch wether a query is an empty record set. It has 2 parameters, 1 querying the TxtTransactionType field and 2 a between Date range entered from a form. My statement below is not working. I have changed the syntax numerous times and it doesn't error out but my Query is always empty even when it should not be.
I put a me.requery before I ran the test and it returned data to the form. But then popped up the message box with my error message for "no records found" then cleared my form....(which is what it is suppose to do when it returns no records). Everything I have researched says I should be able to do this.
I have another form which queries totals for all transactions and that statement is working fine. But the minute I add the TxtTransactionType into the mix I have problems. The Used_Date is the date range the start and end date queries. This works fine.
If DCount("Used_Date", "Query Transaction Type", "TxtStartDate=#" & Me.TxtStartDate & "# AND TxtEndDate=#" & Me.TxtEndDate & "#") = 0 Then
I have tried both formats below but to no avail: I put the "*" in place of the Used_date because when I use Used_date it errors out. Don't understand why I can't count the Used_Date even though I have 2 parameters.
If DCount("*", "Query Transaction Type", "TxtTransactionType=' & Me.TxtTransactionType & ' AND TxtStartDate=#" & Me.TxtStartDate & "# AND TxtEndDate=#" & Me.TxtEndDate & "#") = 0 Then
If DCount("*", "Query Transaction Type", "TxtTransactionType='Me.TxtTransactionType' AND TxtStartDate=#" & Me.TxtStartDate & "# AND TxtEndDate=#" & Me.TxtEndDate & "#") = 0 Then
Help please.