By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

Where condition

P: n/a
Hi!
The following code give me an error message (syntax error 3075) and I can't
figure out what is wrong! Any suggestions?

Sigurd

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
Nov 12 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On Fri, 3 Oct 2003 15:47:40 +0200, "Sigurd Bruteig"
<s-********@online.no> wrote:

Try this:
stLinkCriteria = "[Invoicedate]=#" & Date & "#"

-Tom.
Hi!
The following code give me an error message (syntax error 3075) and I can't
figure out what is wrong! Any suggestions?

Sigurd

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria


Nov 12 '05 #2

P: n/a

"Tom van Stiphout" <to*****@no.spam.cox.net> skrev i melding
news:dl********************************@4ax.com...
On Fri, 3 Oct 2003 15:47:40 +0200, "Sigurd Bruteig"
<s-********@online.no> wrote:

Try this:
stLinkCriteria = "[Invoicedate]=#" & Date & "#"


Thank you Tom, but it is still the same error. The date is correct it seems
(when i hold the cursor over the date it is displayed correctly).
[Invoicedate] is a field in a table, present in the report.

Sigurd
Nov 12 '05 #3

P: n/a
On Fri, 3 Oct 2003 15:47:40 +0200, "Sigurd Bruteig"
<s-********@online.no> wrote:

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria


Maybe stupid, but are you sure that the name [Invoicedate] is part of
your query behind the report?
--
bebelino
Nov 12 '05 #4

P: n/a
Thanks! The solution to a problem could often be a stupid detail that have
been overseen. But in this case the field is in the recordsource of the
report.

Sigurd
"bebelino" <a.*@c.d> skrev i melding
news:6p********************************@4ax.com...
On Fri, 3 Oct 2003 15:47:40 +0200, "Sigurd Bruteig"
<s-********@online.no> wrote:

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria


Maybe stupid, but are you sure that the name [Invoicedate] is part of
your query behind the report?
--
bebelino

Nov 12 '05 #5

P: n/a
"Sigurd Bruteig" <s-********@online.no> wrote in
news:gL*******************@news4.e.nsc.no:

"Tom van Stiphout" <to*****@no.spam.cox.net> skrev i melding
news:dl********************************@4ax.com...
On Fri, 3 Oct 2003 15:47:40 +0200, "Sigurd Bruteig"
<s-********@online.no> wrote:

Try this:
stLinkCriteria = "[Invoicedate]=#" & Date & "#"


Thank you Tom, but it is still the same error. The date is correct it
seems (when i hold the cursor over the date it is displayed
correctly). [Invoicedate] is a field in a table, present in the
report.


[notices ".no" at end of email address]
You may be being tripped up by the localization of your date format. Try

stLinkCriteria = "[Invoicedate]=#" & format(date,"yyyy-mm-dd") & "#"

--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th Centurary Europe. Understand it, and
you can travel to places you never heard of and still understand some people." -- Alex K. Angelopoulos
Nov 12 '05 #6

P: n/a
> The following code give me an error message (syntax error 3075) and I can't
figure out what is wrong! Any suggestions?

Sigurd

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria


Is the field "Invoicedate" a Date/Time data type? If not, you might look for
entries in that field that contain invalid characters.

See http://support.microsoft.com/default...b;en-us;178070.

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #7

P: n/a

"Sigurd Bruteig" <s-********@online.no> skrev i melding
news:66*******************@news4.e.nsc.no...
Hi!
The following code give me an error message (syntax error 3075) and I can't figure out what is wrong! Any suggestions?

Sigurd

Dim stDocName As String
stDocName = "rptFaktura"
Dim stLinkCriteria As String
stLinkCriteria = "[Invoicedate]= " & Date


Thank you all! After hours with trying and failing, I finaly found the right
syntax:
stLinkCriteria = "[Invoicedate] = Date()"
DoCmd.OpenReport stDocName, , , stLinkCriteria

Sigurd
Nov 12 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.