?
Solved

How to change data enviorment data source?

Posted on 2003-03-27
9
Medium Priority
?
223 Views
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?
0
Comment
Question by:marsattack32
[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
  • 6
  • 2
9 Comments
 

Expert Comment

by:tat83
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
0
 

Expert Comment

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

Expert Comment

by:tat83
ID: 8223187
and of course u need to put
rptrepoprt.show
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:marsattack32
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"
?
0
 

Expert Comment

by:tat83
ID: 8230120
yes
the text1 will replace the ? character in the sql statement
example
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 "'"
0
 

Accepted Solution

by:
tat83 earned 200 total points
ID: 8230129
and u need to put
call dataenvironment1.command1 (text1.text)
under a command click event
like
cmd_click()
call dataenvironment1.command1 (text1.text)
report1.show
endsub
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
0
 

Author Comment

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

Expert Comment

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

Expert Comment

by:CleanupPing
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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 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…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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