|
-
Jun 30th, 2005, 06:00 AM
#1
Thread Starter
Addicted Member
Data Report, filter data enviroment with user input
Hi,
Im using VB6 and have a data report with a data enviroment. The data enviroment runs off a query in my access db which combines the adviser with there rotas. The results of the query are a long list of everyone in the db and there rota which is fine. In my interfcae ive got a form called frmselectrota which has a text box, i need the user to be able to enter there ext number (unique) and then when a button is clicked the datareport will be filtered to show only that person rotas. Ive been looking around and i cant seem to find a simple piece of code to filter the data enviroment... as the data enviroment runs frtom a access query there is no vb side sql...
any ideas greatly appriciated!!
-
Jun 30th, 2005, 01:59 PM
#2
Hyperactive Member
Re: Data Report, filter data enviroment with user input
You could create a command object that uses an SQL string, and rewrite the string in code when you call the command object, using the commandtext property
VB Code:
if dataenvironment1.rsMyCommand.State = adStateOpen then dataenvironment1.rsMyCommand.close
dataenvironment1.commands("MyCommand").commandtext = "select something from MyRotaQuery where somefield = '" & frmselectrota.Text1 & "'
Of course omit the single quotation marks if it is not a string variable.
-
Jun 30th, 2005, 09:10 PM
#3
Re: Data Report, filter data enviroment with user input
Something like this should also work...
VB Code:
DataEnvRpt.rsCommandRpt.Open "your sql"
Report.Refresh
Report.Show
DataEnvRpt.rsCommandRpt.Close
-
Jul 1st, 2005, 04:05 AM
#4
Thread Starter
Addicted Member
Re: Data Report, filter data enviroment with user input
dee-u, hello mate, the code you suggest.. is where would that be placed... on the command button on the selection form?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|