PC Review


Reply
Thread Tools Rate Thread

DoCmd.OpenReport WHERE clause syntax

 
 
=?Utf-8?B?Y2ljZXJvbmU=?=
Guest
Posts: n/a
 
      2nd Aug 2007
I am trying to print a simple nametag using the following syntax:

DoCmd.OpenReport "NameTag", acViewNormal, , VID=lngVID

VID refers to a field name and lngVID is a variable (long integer). The
result of this line of code is a single printed nametag with #Error printing
instead of [Name] as specified in the report (though that doesn't happen when
running the report manually).

Any help would be much appreciated!

 
Reply With Quote
 
 
 
 
RoyVidar
Guest
Posts: n/a
 
      2nd Aug 2007
"cicerone" <(E-Mail Removed)> wrote in message
<C74BE1D2-06B3-439F-B4C8-(E-Mail Removed)>:
> I am trying to print a simple nametag using the following syntax:
>
> DoCmd.OpenReport "NameTag", acViewNormal, , VID=lngVID
>
> VID refers to a field name and lngVID is a variable (long integer).
> The result of this line of code is a single printed nametag with
> #Error printing instead of [Name] as specified in the report (though
> that doesn't happen when running the report manually).
>
> Any help would be much appreciated!


The WhereCondition is a string arguement, so you need to pass it a
string, which is constructed as a valid SQL WHERE clause without the
keyword WHERE, so

DoCmd.OpenReport "NameTag", acViewNormal, , "VID=" & lngVID

would probably do the trick

--
Roy-Vidar


 
Reply With Quote
 
Baz
Guest
Posts: n/a
 
      2nd Aug 2007
DoCmd.OpenReport "NameTag", acViewNormal, , "VID=" & lngVID

"cicerone" <(E-Mail Removed)> wrote in message
news:C74BE1D2-06B3-439F-B4C8-(E-Mail Removed)...
> I am trying to print a simple nametag using the following syntax:
>
> DoCmd.OpenReport "NameTag", acViewNormal, , VID=lngVID
>
> VID refers to a field name and lngVID is a variable (long integer). The
> result of this line of code is a single printed nametag with #Error

printing
> instead of [Name] as specified in the report (though that doesn't happen

when
> running the report manually).
>
> Any help would be much appreciated!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax docmd.openreport with more criterea Peter Microsoft Access Form Coding 2 10th Jul 2010 10:19 PM
Re: Where Clause Error In The DoCmd.OpenReport Ken Snell Microsoft Access Forms 0 13th Nov 2009 05:59 AM
DoCmd.OpenReport suddenly failing, macro OpenReport succeeds MattE Microsoft Access 2 4th Sep 2007 02:16 PM
OpenReport - the WHERE clause =?Utf-8?B?SmVu?= Microsoft Access VBA Modules 2 27th Jul 2005 12:59 AM
docmd.openreport where clause syntax =?Utf-8?B?VGVk?= Microsoft Access VBA Modules 6 26th Jan 2005 04:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:25 PM.