473,503 Members | 3,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using UniqueID numbers in a link criteria statement

2 New Member
I am trying to resolve a problem where I need to create a report that is generated from the uniqueID number allocated in a table as an autonumber.
My code looks like this:

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rpt Trial'"
stLinkCriteria = "[OpCommandID] = 1,3,4,7"
DoCmd.OpenReport stDocName, acPreview,,stLinkCriteria

It is the link criteria in line 4 that I cannot seem to get right. The intention is to put the details of unique ID 1, 3, 4 and 7 from a single table into the report. If I take out the '3,4,7' bit from the code, then the report generated reflects record 1 correctly. As soon as I add more numbers to the mix, I keep getting syntax errors.

Can anyone give me an idea of how I can do this? Thanks
Oct 15 '07 #1
3 1568
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi Steve,

Try this ... (Not sure if it will work on the link criteria)

Expand|Select|Wrap|Line Numbers
  1.  Dim stDocName As String
  2.  Dim stLinkCriteria As String
  3.  stDocName = "rpt Trial'"
  4.  stLinkCriteria = "[OpCommandID] IN (1,3,4,7)"
  5.  DoCmd.OpenReport stDocName, acPreview,,stLinkCriteria
  6.  
Oct 15 '07 #2
Steve Horrell
2 New Member
Hi Steve,

Try this ... (Not sure if it will work on the link criteria)

Expand|Select|Wrap|Line Numbers
  1.  Dim stDocName As String
  2.  Dim stLinkCriteria As String
  3.  stDocName = "rpt Trial'"
  4.  stLinkCriteria = "[OpCommandID] IN (1,3,4,7)"
  5.  DoCmd.OpenReport stDocName, acPreview,,stLinkCriteria
  6.  

Would never have thought that way but hey, it works perfectly. Thanks for your help.
Oct 15 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
Would never have thought that way but hey, it works perfectly. Thanks for your help.
You're welcome
Oct 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1918
by: David Berry | last post by:
Hi All. I'm trying to write an ASP page that shows me the UNIQUE account number for a customer (so I can pass it to another page) based on a search criteria. For example, I want to do a select...
112
10218
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please,...
3
13809
by: Peter Phelps | last post by:
My problem is as follows: I need automatically iterate through a single field in a table and use the values in the field to create an in-statement. Currently, the character limitation in the...
5
1942
by: Colleyville Alan | last post by:
I have built a SQL statement that is trying to loop through the fields of a table that was built from a spreadsheet and hence is "short and fat". So rather than hard-coding, I have a loop from...
3
2957
by: I_was_here | last post by:
Hey if anyone is a query pro please showoff some knowledge thx. Ie: I have a table with : part price location qty 1 part repeats throughout the table and its price remains the same but it...
1
3907
by: David Whitney | last post by:
Hi, all. I'm trying to work with some client-side scripting issues with an ASP.NET application. I realize I've probably done something wrong, but at the moment it looks to me like an...
11
3846
by: DP | last post by:
hi, i have a films table and form. i have a txt field in teh form called txtSearch , and i;ve created a query with all the film table fields in it. how can i get the query to load up, wth the...
3
1977
by: Bob Alston | last post by:
I have recently been trying to determine the best technique to pull the least amount of info across the LAN link in a slow speed LAN situation (e.g. < 10 Mbps), where data volume = performance. ...
1
4256
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.