Upgrade to MS Access Project

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and #" &
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" & Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 
On SQL-Server, you must replace the pound sign # with single quotes ' around
your dates.
 
I replaced the # with the single quotes but it still doesn't filter the
records. Any other suggestions.

Thanks Jerry

Sylvain Lafontaine said:
On SQL-Server, you must replace the pound sign # with single quotes ' around
your dates.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Jerry said:
This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and #" &
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" &
Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 
What do you mean "no longer works"? Is there an error message or is it
returning the wrong data?

Also- can't quite tell if this is my news reader, a cut&paste problem, or a
retyping problem- but it looks like you're missing spaces between
[expirationdate]/[begdate] and 'between'.

Good Luck!
--

Chaim


Jerry said:
I replaced the # with the single quotes but it still doesn't filter the
records. Any other suggestions.

Thanks Jerry

Sylvain Lafontaine said:
On SQL-Server, you must replace the pound sign # with single quotes ' around
your dates.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Jerry said:
This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and #" &
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" &
Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 
There is no error message but it returns the entire recordset instead of the
search criteria. It works fine in Access but not in Access Project. If I use
a parameter within the stored procedure it will filter. It just won't filter
from the form.

Jerry

Chaim said:
What do you mean "no longer works"? Is there an error message or is it
returning the wrong data?

Also- can't quite tell if this is my news reader, a cut&paste problem, or a
retyping problem- but it looks like you're missing spaces between
[expirationdate]/[begdate] and 'between'.

Good Luck!
--

Chaim


Jerry said:
I replaced the # with the single quotes but it still doesn't filter the
records. Any other suggestions.

Thanks Jerry

Sylvain Lafontaine said:
On SQL-Server, you must replace the pound sign # with single quotes ' around
your dates.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and #" &
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" &
Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 
I've just made a quick test and there is no problem on my side.

It is possible that you may have a localization problem if the SQL-Server
installation is not EN-US.

Display the strWhere to make sure that it is correct and try it inside
SQL-Server' Query Analyser.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Jerry said:
There is no error message but it returns the entire recordset instead of
the
search criteria. It works fine in Access but not in Access Project. If I
use
a parameter within the stored procedure it will filter. It just won't
filter
from the form.

Jerry

Chaim said:
What do you mean "no longer works"? Is there an error message or is it
returning the wrong data?

Also- can't quite tell if this is my news reader, a cut&paste problem, or
a
retyping problem- but it looks like you're missing spaces between
[expirationdate]/[begdate] and 'between'.

Good Luck!
--

Chaim


Jerry said:
I replaced the # with the single quotes but it still doesn't filter the
records. Any other suggestions.

Thanks Jerry

:

On SQL-Server, you must replace the pound sign # with single quotes ' around
your dates.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and
#" &
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" &
Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 
Thanks for all your help
That worked
Jerry

Sylvain Lafontaine said:
I've just made a quick test and there is no problem on my side.

It is possible that you may have a localization problem if the SQL-Server
installation is not EN-US.

Display the strWhere to make sure that it is correct and try it inside
SQL-Server' Query Analyser.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Jerry said:
There is no error message but it returns the entire recordset instead of
the
search criteria. It works fine in Access but not in Access Project. If I
use
a parameter within the stored procedure it will filter. It just won't
filter
from the form.

Jerry

Chaim said:
What do you mean "no longer works"? Is there an error message or is it
returning the wrong data?

Also- can't quite tell if this is my news reader, a cut&paste problem, or
a
retyping problem- but it looks like you're missing spaces between
[expirationdate]/[begdate] and 'between'.

Good Luck!
--

Chaim


I replaced the # with the single quotes but it still doesn't filter the
records. Any other suggestions.

Thanks Jerry

:

On SQL-Server, you must replace the pound sign # with single quotes '
around
your dates.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


This search form no longer works.
Can someone help me find out the problem?

Thanks Jerry


Private Sub cmdView_Click()
On Error GoTo Err_cmdView_Click

Dim strWhere As String

Me.Visible = True
strWhere = ("[expirationdate]between #" & Me.FromDate & "# and
#"
&
Me!ToDate & "#) or ([begdate]between #" & Me.FromDate & "# and #" &
Me.ToDate
& "#")
DoCmd.OpenReport ReportName:="rptLease", _
view:=acPreview, WhereCondition:=strWhere
DoCmd.SelectObject acReport, "rptLease"



Exit_cmdView_Click:
Exit Sub

Err_cmdView_Click:
MsgBox Err.Description
Resume Exit_cmdView_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top