Solved

data environment

Posted on 2000-05-02
10
144 Views
Last Modified: 2010-05-02
I have a data environment.  One of the commands is a SQL statment "Select * from labelshistory where (Status = 'PRINT') AND (EmployeeId = x)
I need to be able to pass the value for x.  Can someone tell me how to pass the paramater to the sql statement
0
Comment
Question by:jrspano
10 Comments
 
LVL 1

Expert Comment

by:nguyenn
ID: 2769599
If x is declared as integer,then you can try this:

"Select * from labelshistory where [Status]= '" & PRINT & "' and [EmployeeId] = " & x

0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2769625
Set your SQL string like:

SQL = "Select * from labelshistory where (Status = 'PRINT') AND (EmployeeId = '" & Format$(x) & "')"

Then make your call.
0
 
LVL 3

Author Comment

by:jrspano
ID: 2769894
It won't take the statement in the properties of the command in the data environment
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:GivenRandy
ID: 2769991
Did you try mine?  I put the x value in single quotes because we have had the same problem.
0
 
LVL 3

Author Comment

by:jrspano
ID: 2770010
Yes i tried that one two.  In the data environment window i need a way to set the command's sql statement in code instead of entering it in the window.  then the above would work.  there may also be a way to enter the parameter in the window but the parameter tab is always greyed out and i can't get it to work.
0
 

Accepted Solution

by:
Five_Bs earned 40 total points
ID: 2770222
Have you tried enclosing the X value in square brackets making it a Named Parameter.  e.g. [X]

Check out "Specifying Parameter Marker Characters" in the MSDN Library
0
 
LVL 3

Author Comment

by:jrspano
ID: 2770298
this is getting closer.  How do you pass the value of x to the data environment?  It will let me run the program without any errors now but it returns an empty recordset because x is empty.  when x changes in the program i need a way to send it to the data environment and have it refresh.
0
 
LVL 3

Author Comment

by:jrspano
ID: 2770424
I solved it by using an ado control on the form instead of a data environment.  this let me set the sql string in code.
0
 
LVL 3

Author Comment

by:jrspano
ID: 2829399
five bs if you will give another comment i'll give you the points.  your answer got me the closest
0
 
LVL 3

Author Comment

by:jrspano
ID: 2864588
Comment accepted as answer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question