How to change data enviorment data source?

Posted on 2003-03-27
Medium Priority
Last Modified: 2010-05-01
I am using VB to access an MS access database.  I am using VB6 as the front end.  I create a report in VB which access a query in the MS access database.  In that query there is a date field.  I would like to change the data enviroment data source so that I can select a date range to be display in the report.  Any one know how?
Question by:marsattack32
  • 6
  • 2

Expert Comment

ID: 8223150
u can use sql to do so and during run time u pass parameters to data environment
like this
select * from customer where DOB > #?#
on cmd view report
call dataenvironment1 text1.text

Expert Comment

ID: 8223161
it supoose like this
call dataenvironment1.command1 (text1.text)
where text1.text is ur paramater

Expert Comment

ID: 8223187
and of course u need to put
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 8225527
Do you put this at the dataenviorment_initialize stage?

I am still not sure what you mean by
call dataenvironment1.command1 (text1.text)
where text1.text is ur paramater

Where to I need to call dataenviroment1.command1(text1.text)

so text1.text will be like "select * from tbl_test where date > 1/1/03"

Expert Comment

ID: 8230120
the text1 will replace the ? character in the sql statement
if text1.text=11/2/03
then the sql is
select * from tbl_test where date > #11/2/03#
And another thing i remind u is when u deal with date type
u need to put "#" instead of "'"

Accepted Solution

tat83 earned 200 total points
ID: 8230129
and u need to put
call dataenvironment1.command1 (text1.text)
under a command click event
call dataenvironment1.command1 (text1.text)
In other word, whenever u want to view the report u need to pass in the parameter so it can execute
And on datareport unload/terminate event
u need to put this
unload dataenvironment
if not, the same report will be shown every time u click view report button althought the parameter pass in is different
because it is still in the memory, so the same sql is execute with the same parameter which pass in the 1st time
Hope i can help u

Author Comment

ID: 8231783
I got it to work, thanks for your great help

Expert Comment

ID: 8232654
hi marsattack32
i am glad i can help
So can i get the points as my reward
thank you

Expert Comment

ID: 8531444
Hi marsattack32,
This old question (QID 20566020) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

571 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