Solved

data environment

Posted on 2000-05-02
10
139 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now