Solved

data environment

Posted on 2000-05-02
10
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: 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

Suggested Solutions

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.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

739 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