Vulcan1500
Registered User.
- Local time
- Today, 19:08
- Joined
- Nov 13, 2007
- Messages
- 143
In VBA I would like to filter a recordset using the comboboxes on a form. I have three comboboxes. One for the year, one for the quarter and one for VAT. The comboboxes are populated correctly. Afrte selecting a value for the year the recordset is filtered. This also is done when the quarter is selected. The problem starts when I select VAT. I believe that the cause of the problem is that VAT is a percentage. The statement in the WHERE clause is:
After selections the strWhere is:
qryBTWOverzichtFactuur.JaarKwartaal='2015-1' AND qryBTWOverzichtFactuur.BTWTarief = 0,21
When I manualy change 0,21 (21%) to 0.21 it works, but I'm unable to force this format in the query.
Any advice on this is much appreciated.
Code:
strWhere = "qryBTWOverzichtFactuur.JaarKwartaal='" & Me.cboJaar & "-" & Me.cboKwartaal & "' AND " & "qryBTWOverzichtFactuur.BTWTarief = " & Me.cboBTWTarief
strSql = strSql & "SELECT qryBTWOverzichtFactuur.pkFactuur, "
strSql = strSql & "qryBTWOverzichtFactuur.JaarKwartaal, "
strSql = strSql & "qryBTWOverzichtFactuur.Nummer, "
strSql = strSql & "qryBTWOverzichtFactuur.Datum, "
strSql = strSql & "qryBTWOverzichtFactuur.Bedrijfsnaam, "
strSql = strSql & "Format([qryBTWOverzichtFactuur].[TotaalexBTW],'Currency'), "
strSql = strSql & "Format([qryBTWOverzichtFactuur].[BTWTarief],'Percent'), "
strSql = strSql & "Format([qryBTWOverzichtFactuur].[TotaalBTW],'Currency'), "
strSql = strSql & "Format([qryBTWOverzichtFactuur].[TotaalinBTW],'Currency'), "
strSql = strSql & "qryBTWOverzichtFactuur.DatumBTWAfgedragen "
strSql = strSql & "FROM qryBTWOverzichtFactuur WHERE "
strSql = strSql & strWhere
qryBTWOverzichtFactuur.JaarKwartaal='2015-1' AND qryBTWOverzichtFactuur.BTWTarief = 0,21
When I manualy change 0,21 (21%) to 0.21 it works, but I'm unable to force this format in the query.
Any advice on this is much appreciated.