Solved

data environment

Posted on 2000-05-02
10
138 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

743 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

14 Experts available now in Live!

Get 1:1 Help Now