Adding Field To Recordset Before Showing Datareport
Hello,
I want to set up a datareport that shows something like this (simplified) :
PlaceNumber Name Points --------------------------------------------- 1 John 10 2 Paul 9
etc.
I have my recordset made up like this :
Code:Option Explicit
Dim strSQL As String 'string die SQL bevat. Dim rsADODagKlassement As New ADODB.Recordset
Private Sub DataReport_Initialize() 'SQL string creëren strSQL = "SELECT tblPlayer.txtNaam, tblPlayer.txtVoornaam, tblPlay.intPlayNumber, " strSQL = strSQL & "tblPoints.intFives * 5 + tblPoints.intFoures * 4 + tblPoints.intThrees * 3 + " strSQL = strSQL & "tblPoints.intTwos * 2 AS intTotaal, " strSQL = strSQL & "tblPoints.intFives , tblPoints.intFoures, tblPoints.intThrees, " strSQL = strSQL & "tblPoints.intTwos, tblPoints.intDefense " strSQL = strSQL & "FROM tblDate, tblPlay, tblPoints, tblPlayer " strSQL = strSQL & "WHERE tblDate.intDateID = tblPlay.intDateID AND " strSQL = strSQL & "tblPlay.intPlayID = tblPoints.intPlayID AND " strSQL = strSQL & "tblPlay.strRijksregister = tblPlayer.txtRijksregister AND " strSQL = strSQL & "tblDate.intDateID = " strSQL = strSQL & gmintDatumCodeRapporten & " " strSQL = strSQL & "ORDER BY tblPoints.intFives * 5 + tblPoints.intFoures * 4 + tblPoints.intThrees * 3 + " strSQL = strSQL & "tblPoints.intTwos * 2 DESC, tblPoints.intDefense DESC " 'Recordset creëren Call CreateRecordset 'rapport linken Set repDagKlassement.DataSource = rsADODagKlassement 'Datum op rapporthoofd plaatsen Me.Sections("ReportHeader").Controls.Item("lblTitle").Caption = "Dagklassement van " & gmstrDatumRapporten Me.Sections("PageFooter").Controls.Item("lblPageFoot").Caption = "+++ " & gmstrDatumRapporten & _ " +++ Shooting Team Oostende" End Sub
Private Sub CreateRecordset() 'Gehele tabel openen With rsADODagKlassement .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open strSQL, gmcnnADOShooting, , , adCmdText End With End Sub
Now I want to add a field to this recordset where i can populate the placenumbers.
Can anyone help me with this ???
Or is it possible to just place code in datareport_Initialize that places a number for each recordline in the report ???
Hoping anyone can help me ???
RoCa Greetz U
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Showing Datareport Empty Field Borders
I have a datareport that works perfectly in every way, except that my empty fields do not show borders. I have some fields that get their data from a database, which work fine. The problem is the empty fields, which need to show just empty cells, but instead have no border and are just empty space. (The user will print out the form and fill in these last parts by hand, so I need to make the form idiot resistant and clearly show the spaces to write in. The borders for all the fields are set as "1-rtBSSolid". The empty fields are labels. Any help is appreciated
(btw, I posted this to another forum and have gotten no help, so I'm hoping DevShed will come through for me )
Adding A Field To The Begining Of A Recordset
Is there anyway of adding a field to the beginning of a ADODB recordset which is already populated? I would rather not changed the stored procedure which creates the recordset or have to create a new stored procedure. I don't think rs.Fields.Append can do this, can it?
Cheers
G
Adding Nullable Field To Recordset?
hi all,
i have a recordset that I create in code. trouble is one of my fields needs to be able to be blank, but i get a
"canoot set non nullable field to null" error.
here's my recordset creating code:
sfsRS.ActiveConnection = Nothing
With sfsRS.Fields
.Append "Item_No", adBigInt
.Append "Description", adBSTR
.Append "Seq", adInteger
.Append "Cases Per Hour", adInteger
.Append "Qty", adDouble
.Append "Load (Hours)", adDouble
.Append "SHIP_DATE", adBSTR
.Append "SHIP_TIME", adBSTR
.Append "Comments", adBSTR
End With
the field i need to have allowed nulls is "Seq".
Showing Data From One Field But Using Another Field For Entry
I am wanting to use one field from a table for a user to select from but have the data from the other field corresponding to the selection to be what is saved on the form. e.g.
Field - OblCode Field - OblDescr
0001 Prime
0002 Subprime
0003 HLTV
If the user selects Prime, I want 0001 to populate the field. Any ideas?
Pb Showing Datareport
Hy!
I've been working on datareports for few days and here is my problem.
I would like to show in that report those informations
Firstname - Lastname - Picture
Orders of this person (= date, objet, place, price)
There can be several orders.
I get a Recordset from my database with all those informations.
So i tried to put everything in the 'Détail section' but at each order i get a new page !!!?
So can't we put 'single informations' and 'repeated informations' on the same section ? Is there any way to get this result ?
Ok i could put (Firstname - Lastname and the picture) in the header section
and put orders in the détail section, but my problem in that case is that if there are many orders, i would have a second page with header and not only orders informations. ? Am i clear enough ??? (sorry for my english...)
Or could i create a 'second détail section' ?! (i guess no)
Well many thanks for answers.
Datareport Columns Not Showing Up
I have a datareport which is landscape so everything I need should fit. However, it will not print my last two columns. There is more than enough room on the preview and printed report for these to be there. I have included a JPG of the report preview to show how much room is there. I have all my margins set to zero, have my ReportWidth property set to 15840 which is 11 inches. The only thing I can think of is the regular "Width" property of the report is set to 15360 and will not change to be the same as the "RepotWidth" property. Shouldn't the ReportWidth property determine what can fit on the report? Not the Width of the preview window. I'm confused. Any help would be great.
Randy
DataReport Not Showing Multipages
i'm using datareport in vb 6.0...but after i run the program the report is showing only 1 page data...not all data is visible...is it necessary and how to declare it multipage?
DataReport Showing Greater Than 24 Hours
Using no DataEnvironment
VB6 and access.mdb
I have cut snippets out but you should get the idea.....
i send a qry asking :
select (`Total_mins`-(`Break_mins` + `Lunch_mins`))/1440 As RHours from...
With DataReport2.Sections("Section7").Controls
.Item("Function4").DataMember = "Command2"
.Item("Function4").DataField = "Rhours"
.Item("Function4").FunctionType = rptFuncSum
End With
In the datareport i have hardcoded a custom format for "Function4" = "Hh:Nn"
The max Hours given is 24.
Does anyone have any ideas to display times greater than 24 hours as a total?
Thank you in advance.
How To Capture Keystrokes While Datareport Is Showing?
The only way for me to close the datareport after a
datareport.show command is by pressing the X button at
upper right corner of screen. Is it possible to
capture keydown events or keypress events so in
exiting data report i can just press "esc" key to
close the datareport window.
Static Screen After Showing Datareport
hi guys,
i am using vb 6 ,data reports and sql server 2000.
i am passing a sql command to the dataenvironment during runtime and after that i am invoking the datareport .and my data report is taking around 2 minutes to be processed and shown.
and in this 2 minutes the whole screen(i mean this particular application)is becoming static and not even the timer control is working to refresh the time which is shown in the status bar of the parent form.
once the datareport is shown then everything is working fine.
what i think is the processing of the report is consuming the whole resources of this particular application.
what i want to do now is as soon as the user clicks the show report button i want to show him a notice "please wait "(or something like this) . i have tried to display a form first in the click event of show report button before invoking the datareport but before the form is shown completely only the screen is becoming static i mean the form is being half displayed and after the datareport is shown the form is completely being displayed.
pls give me a solution for this problem
thanks
Multiply A Field In Datareport With A Field In SQL DB
Maybe this question was answered elsewhere, if so I'm sorry, I didn't find it
I connect to an SQL DB with ADO. I've set up a nice report with Datareport but now I want to modify value in certain field at runtime.
Ex.: I have these fields in my table PRODUCT
- PRODUCTID
- NAME
- PRICE
and these in table TRANSACT
- TRANSACTID
- QTY
- PRODUCTID (which is linked to PRODUCT)
When I call my report, I ask for NAME, QTY and PRICE. But I want to set at that very moment the total price per PRODUCT ( QTY * PRICE ) and have it print in my report.
I tried many things, but all I can get is the first total price repeated for every element.
thanks for your help!
Chris
Edited by - hades5k on 8/29/2003 7:55:28 AM
I Need A Way To Update A Field Based On The Value Of Another Field In The Recordset
Basically, I have this form that allows you to take temporary records and place them in the permanent table, and assigns them a CertNo based on the last available CertNo. This is all works fine, but now there will be a Different CertNo depending on which certification you are. I need to be able to look up the last CertNo for each Cert type.
Below is the code that assigns the data to the query that the will hold the data.
Any ideas?
Code:
Private Sub cmdMigrate_Click()
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strCertNo As String
Dim strSQL As String
Dim strQueryName As String
Dim dbs As Database
Dim rst As Recordset
Set frm = Forms!frmMigration
Set ctl = frm!lstMultiSelect
strSQL = "SELECT * FROM [qryExamPassed] WHERE [qryExamPassed].[SSAN]='"
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & "' Or [qryExamPassed].[SSAN]='"
Next varItem
strSQL = Left$(strSQL, Len(strSQL) - 28)
strQueryName = "qryExamMigrate"
CreateCertQuery strSQL, strQueryName
Set dbs = CurrentDb
Set rst = OpenForSeek("tblCertification")
rst.Index = "CertNum"
rst.MoveLast
strCertNo = rst!CERT_NO
rst.Close
Set rst = dbs.OpenRecordset("qryExamMigrate")
Do
strCertNo = LTrim(Str(Val(strCertNo) + 1))
rst.Edit
rst("TEMP_CERTNO") = strCertNo
rst.Update
rst.MoveNext
Loop Until rst.EOF
rst.Close
DoCmd.Close
DoCmd.OpenForm "frmMigration2"
End Sub
If I Select A Field Data Is Showing The....
Hi there,
If I select a Field in a DataGrid the data is showing other records ??? Meaning the first time I start the app. and click on the letter (K) I get the FIRST RECORD in the list showing, than I select the letter (W) it shows the letter (K) allways the previous one, and so on. (Showing in TextBoxes).
I'm using:
VB Code:
Private Sub DataGrid1_Click()'---Text1.Text = DataGrid1.Columns(0)Text2.Text = DataGrid1.Columns(1) End Sub
I know:
I did SEARCH all last night for DataGrid threads here on VBForums and elsewhere too, but came up with nothing, except the advise to use MSFlexGrid. Well, OK I will try yhat in my next app !!! promise.
But now, ??? could somebody help please. I used binding and here it works very well, but I can't use it as I need to bind these TextBoxes to something else.
Thanks aktell
Showing Multiple Coloumns In A Combo Field
Hi
Does anyone know if it is possible to show multiple fields (obtianed from a query) in a drop down combo box. I know this can easily be done in Access but I have not seen any examples of this in VB or in the property section.
Regards
Yamin
MSFlexgrid Showing Only The Last Row Of The Recordset.
We have an application developed in Visual Basic 6 which uses SQL
Server 2000 and is running at many locations. Most of the places
have been running it on Windows XP with SP1. Recently in one
remote location, some new clients were added with windows xp
with SP2 applied. Now it was noticed that the programs which
were using msflexgrid is showing only the last row of the
recordset. Here ADO is used and the records are filled into the
grid in a loop. The same works ok on the older clients. What
could be the reason? How to rectify this? Please help.
Thanks
Kay
Adding Numbers && Showing A Total
what type of code should i use to add a number of values and show a total at the bottom, e.g. click a button, then in a text box it will say what youve clicked and how much it is, and then add the values to give you a total at the bottom of the screen??
MSFlexGrid Not Showing All Rows Of Recordset
Hello all,
I am having trouble with MSFlexGrid, where on some machines the entire results of the RecordSource are displayed but on others it stops short. The result set should contain about 35,500 records, but on the bad machines, it is returning about 500 less (or at least displaying 500 less).
All the machines are using ODBC to connect to the same Access97 database on our LAN and are running the same version of code.
Is there something that should be set locally? Or any special .dll's or local files that we should check? We've compared the dates of all files found in the setup log on the good machines with the bad and have updated where needed, but this does not seem to make a difference. Also, we set up the users with System DSN's - should we have used User DSN's instead?
If the only place that the problem could be stemming from is the code, what properties should I be checking or setting?
We are really at a loss here and would greatly appreciate any help or direction.
Thanks in advance,
lwags
In case you need it, the code to populate the grid looks like this:
frmRep.adReport.Connect = "ODBC;DATABASE=;UID=" + gsDbID + ";PWD=" + gsDbPassword + ";DSN=TAD"
frmRep.adReport.RecordSource = sRecordSource
...
frmRep.adReport.Refresh
frmRep.grdReport.Visible = True
frmRep.grdReport.Enabled = True
Where frmRep is the Form, adReport is the Data Control, sRecordSource is a SQL string and grdReport is the MSFlexGrid.
Data Present In Recordset Not Showing Up
Hi,
I've got the following code:
VB Code:
rs.Open sqlQuery, con, adOpenKeyset, adLockOptimisticIf Not ((rs.EOF) Or (rs.BOF)) Then Set MSHFlexGrid1.Recordset = rs ''Error comes here.End If
The problem is on the line where recordset is being set. The error description is
Quote:
Unable to access data. DataSource settings may be incorrect or the DataSource functionality may be limited. See Help for more information.
In the Immediate window following are the things that I checked for
Quote:
?rs(0).Value
1730
?rs.RecordCount
-1
And this is somewhat confusing.. If I've records in the recordset why will it show -1 recordcount.
All help appreciated. Thanks.
eDIT: Some more info I think should be more helpful. The database is Sybase and the connection string is as follows;
VB Code:
connectionString = "DRIVER={Sybase System 11};SRVR=TestServer;DATABASE=testDatabase;UID=developer;PWD=p@ssw0rd"
. Thanks.
Added Records Not Showing In Recordset
I have a problem where i add a client record to a recorset through vb, it adds to the database but wont show in the recordset when scrolling through vb.
Heres the code I am using:
VB Code:
Private Sub Form_Load() Set cnDetails = New Connection Set comDetails = New Command Set rsDetails = New Recordset Dim strDetails As String 'Determines the provider and the connection to 'the specified database. cnDetails.Provider = "Microsoft.Jet.OLEDB.4.0" cnDetails.ConnectionString = "A:VBPRO_Compacted.mdb" 'Opens the connection cnDetails.Open comDetails.ActiveConnection = cnDetails 'SQL statement strDetails = "SELECT tblClient.C_Number, tblClient.C_F_Name, tblClient.C_L_Name, tblClient.C_Street, tblClient.C_Town, tblClient.C_County, tblClient.C_Phone, tblClient.C_Age, tblClient.C_Preferences, tblClient.C_Gender, tblClient.Notes, tblStaff.S_F_Name FROM tblStaff INNER JOIN tblClient ON (tblStaff.S_Number = tblClient.C_Prefered_Stylist)Order By tblClient.C_Number Asc " rsDetails.Open strDetails, cnDetails, adOpenStatic, adLockOptimistic 'Calls the BindData funtion BindData End Sub Private Sub cmdAdd_Click() 'Allows the user to add a new record'to the list of clients.'Hides the various text/Combo boxes. txtFName.Locked = False txtLName.Locked = False txtStreet.Locked = False txtTown.Locked = False cboCounty.Locked = False txtPhoneNo.Locked = False txtPreferences.Locked = False cboStylist.Locked = False cboGender.Locked = False cboAge.Locked = False cmdHistory.Visible = False cmdAddSave.Visible = True fraControls.Visible = False cmdBack.Visible = True rsDetails.AddNew End Sub Private Sub cmdAddSave_Click()rsDetails.Update MsgBox "Record Added Successfully", vbInformation, "Client Record Added"End Sub
Adding Two Field's Data Ino One Field
hello
The following SQL command adds two fields data into one field.
tbl1 structure:
_____________________________
field1 field2
a1 b1
a2 b2
a3 b3
a4 b4
____________________________
Select field1,field2 as fieldNew from tbl1;
the result is :
___________________________
fieldNew
a1b1
a2b2
a3b3
a4b4
__________________________
But I want to get:
_________________________
fieldNew
a1
a2
a3
a4
b1
b2
b3
b4
________________________
Please anyone help me to solve this problem.
Thank you all.
Bye...
Showing Data From ADODB.Recordset In A Listbox
New to programming. I need to show data from an ADODB.Recordset saved in a .txt file in a listbox. The program works fine (well almost) but I cannot link the data to show in a listbox. There are 4 fields of data, I need just one to show in my listbox (name). Here's a sample of the code i had tried but didnt work
Set objDataSource = New ContactDataSource
Set colBind = New BindingCollection
Set colBind.DataSource = objDataSource
colBind.Add lstName, "Text", "addName"
When I replace the listBox control with a textBox (for experiment sake), the "Text", "addName" shows up, so I know the code writes and reads from the .txt source properly. I just need to "connect" the listBox with the data.
Please pardon my lack of knowlege in VB nomenclature and explanations, It is hard when your at the bottom lookin up.
Also....when I try to add data to my recordset I need to hit my cmdAddData button once before I can fill the text areas to add to my recordset. When I do this it adds blank " " " " " " " " in my data (don't want that). Any suggestions?
Thanks for any input. If I am not clear...I apologize.
Field In Datareport
I am defining a recordset for use on a datareport but the sex is True for male and false for female. How can I reset this value to Male or Female?
I simply set the recordset by defining it before opening the report:
set dtpReport.dataSource = myRs
The value for the textfield is
Code:
With dtpReport.sections("section1").controls
.item("txtSex").datafield = myRs!sex
End With
any ideas??
One Form Showing Data From Three Tables Using Single Recordset
I need to display data on a form from a matching record (based upon month) from two tables from the same database. I believe that one recordset can do this using a SELECT...INNER JOIN statement. This is my code so far:
Dim RS1 As Recordset
Set DB1 = DBEngine.Workspaces(0).OpenDatabase("C:PROGRAM1.MDB")
Set RS1 = DB1.OpenRecordset("INCOME", dbOpenDynaset)
Select INCOME.month, EXPENSES.month
from INCOME inner join EXPENSES on INCOME.MONTH = EXPENSES.MONTH
Am I on the right path? What should my code look like to accomplish this task?
Define Field In A Datareport
hi there
Is it possible (and how) to define the value of a field in a datareport according to the value of a record ?
For example, if the value of the record in the db is "I" I'd like to set the value of the DR's field to "Yes", and if teh value of the record in the db is "O" I'd like to set the value of the field to "No"
Thanks
Datareport Calculated Field
I am working on a report that requires me to calculate percent changed
based on records returned from a query. ((Field2-field1) / field1) *100
I can get this to work using rptLabel control for the first record only. When I go to the next record/page the calculated fields ( label.value) are not updated.
Is there any way to do this?
To Print Only The First Value In A Field To Datareport
below is a visualbasic datagrid.
example:
|ID_no| Particulars|
101 |
Lib. fee
101 |
ID
101 |
Comp.Fee
When I'm going to print this, the result in datareport should be like this...
ID_no
|
Particulars
101
|
Lib. Fee
___
|
ID
___
|
Comp.Fee
Only one ID_no appears. Anyone knows how to do this?? pls. reply
Help! DataReport Field Formatting
Is it possible to print out a field as 'Paid' if the field has a value 'Y' and 'Overdue' if the field is blank? I know that I can create a table with the values and use the 'JOIN' function to do that. But is there a simple way in the Data Report to do such a common request?
Also, is there a simple way to concatenate 2 fields and print as one string in the Data Report (something like TRIM(firstname) & " " & TRIM(lastname))?
Please help!
Thanks in advance.
Calculated Field In Datareport
Hey
I've created a datareport based on an sql server.
I've two fields in my table: sales and sales_last_year.
I've got a calculated field in my sql command called difference and it is based on sales - sales_last_year.
What i also want is a field : procent which is based up on (sales - sales_last_year) / sales_last_year so that i can display
in procent the difference between this year and last year.
The problem is that sales_last_year can be 0. You can't split thru 0.
I don't want to define in the where clause where sales_last_year <>0 because I need the other fields even when this field is 0.
I was thriing with IIf(sales_last_year = 0 ; "-"; (sales - sales_last_year) / sales_last_year) as procent but it doesn't work
Can somebody help me!
Greetz
Maeske
Edited by - Maeske on 5/26/2003 2:29:27 AM
Datareport Bold One Field Using Code
I was wondering if anyone could tell me how I could make a field bold by doing it thur code
This is what I have so far, but it is bolding everything
Code:
With .Sections(3).Controls 'Details
.Item("txtMeMe").DataField = rst![MeMe]
End With
rptToxDaily.Sections(3).Controls.Item("txtMeMe").Font.Bold = True
Thanks
he9ap00
DataReport One Field Multiple Colums
Hi,
I want to print address lables from a single address field from access database. The label sheet is 3 columns wide.
In my current attempt I have put a single textbox on the reports detail section which only displays data in the first colums which I don't want.
How do I link the address field to data report so that it distributes records over all 3 columns and then rows instead of rows only.
Filtering A Field Before Printing With A Datareport
Sori 4 the repost... I made a mistake in my previous post
Im a college student and I recently learned to use the data report and data environment through some self studies. This is what im trying to make:
The user of my program types a name into a textbox (txtName) and afterwards clicks on a commandbutton (CmdShow) to show the data report. As CmdShow is clicked, I wish to filter the field 'Name' from table 'Students' (located in an Access file). I want the data report to display only those names which are identical to the name found in the textbox (where txtName.text = Students!name).
This may sound very simple, but I dont know how to use dynamic parameters... . Any help will be highly appreciated
Thanx in advanced
DataReport Field Manipulation At Runtime
I have a text date field in the Access database table (using the MS Jet 4.0 OLE DB Provider in the DataEnvironment) which is in the form dd/yy/mm. I want to have this date copied into a variable numeric date field in the form yymmdd and sort my DataReport in this order, I have looked at the queries and FAQ’s. The one on making a 2 column report gives an example of concatenating two fields, but what I want to do is split up a field into sub fields and then concatenate. Is this possible at runtime?
Adding A DataReport
Last week I could add a DataReport to any of my projects. This was no problem. I'm using the Professional version 6.0. This week I cannot. When I try, I get a message telling me I don't have the appropriate licence to use this functionality . . . blah blah . . .
In Projects->Components I have selected the DataReport . . .(?) Can anyone help me?
Thanks!
John
DataReport From A Recordset
I'm trying to write a report straight from a recordset. No Data Environment.
I keep getting the error "subscript out of range"
code:
Private Sub cmdPrint_Click()
Set drSearch.DataSource = rsSearch
rsSearch.MoveFirst
while not rsSearch.eof
With drSearch.Sections(1)
.Controls("txtLogum").DataField = CStr(rsSearch!Lognum)
End With
wend
drSearch.Show
End Sub
More Than One Recordset In The Same Datareport
is it possible to show more than one recordset in the same datareport?
for example i have a form with three flexgrids all taking records from the same table using the same rs but a different SQL query every time. is there any way i could emulate this in a report?
DataReport RecordSet
I would like to use a recordset that was already created while running my vb application. I want to do this because I'm afraid that my SQL tables would have changed before the report is to be run. Does anybody have any idea's thanks in advance.
Recordset && Datareport ---
I'm using VB6, Access, and datareport in my project. This is how the example report looks like
ProductCode - Description
ProductName Unit UnitPrice
When the datareport is generated;
NN1 - Software
-------------------------
A1 10 50
A2 5 16
A3 3 15
----------------------------------
Sub-Total 18
-----------------------------------
NN2 - Hardware
B1 15 20
B2 8 16
----------------------------------
Sub-Total 23
-----------------------------------
----------------------------------------
Total 41
----------------------------------------
The problem is I have all information in one table except Description. It is stored in another table. How can I get that data to put in datareport? The only way I can think now is create a temp or permanent table and put all data there then generate report.
Can anybody give me some other ideas how to do this? Or at least, if I know what the data in that textbox (ProductCode), I can use the function to get Description from another table. The problem is I don't know what's in that text box
This is the code I use to fill ProductCode textbox
With drtReport.Sections("rptGroupHeader").Controls
.Item("txtProductCode").DataMember = "Level2"
.Item("txtProductCode").DataField = "ProductCode"
.Item("lblProductDesc").Caption = .Item("txtSubSection").Datafield <--- DOES NOT WORK
End With
Thank you in advance for any suggestion.
I tried to use SQL to get data first. This way all info is stored in one recoedset and there is no need to create a table. Somehow, I haven't got it worked yet.
SELECT *, ProductCode AS X, (SELECT Description FROM tblProduct WHERE ProductCode = X)
FROM tblAllInfo
Edited by - prapon77 on 4/20/2005 6:55:31 AM
Filtering A Datagrid Showing A Recordset From A Parameteric Query When Parameters Change?
I am using (ADO, Access & VB6) the following code to populate a datagrid with the contents of an Access query quich receives several paqrameters:
rsMain1.CursorLocation = adUseClient
With adoCommnd
.CommandType = adCmdStoredProc
.CommandText = "Main"
.Parameters.Append .CreateParameter(, adChar, adParamInput, 250, strStatus)
.Parameters.Append .CreateParameter(, adDate, adParamInput, , DTPFromDate.Value)
.Parameters.Append .CreateParameter(, adDate, adParamInput, , DTPToDate.Value)
.Parameters.Append .CreateParameter(, adChar, adParamInput, 250, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 250, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 50, "%")
.Parameters.Append .CreateParameter(, adDBTime, adParamInput, , "00:00:00")
.Parameters.Append .CreateParameter(, adDBTime, adParamInput, , "23:59:59")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 50, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 50, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 50, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 100, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 100, "%")
.Parameters.Append .CreateParameter(, adChar, adParamInput, 100, "%")
If CmbStatus.ListIndex = 0 Then
.Parameters.Append .CreateParameter(, adVarChar, adParamInput, 1, "%")
Else
.Parameters.Append .CreateParameter(, adBoolean, adParamInput, , bStatusType) 'The character open (Yes/No) of the current status
End If
.Parameters.Append .CreateParameter(, adInteger, adParamInput, , iProject) 'The project to which the incident was reported
End With
rsMain1.Open adoCommnd, , 1, 3
With DGMain
Set .DataSource = rsMain1
.Columns(0).Caption = "îñ' ãéååç"
.Columns(0).Width = 800
.Columns(1).Caption = "ñèèåñ"
.Columns(1).Width = 1300
.Columns(2).Caption = "úàøéê ãéååç"
.Columns(2).Width = 1200
.Columns(3).Caption = "úàøéê äàéøåò"
.Columns(3).Width = 1200
.Columns(4).Caption = "ãååç ò'é"
.Columns(4).Width = 1500
.Columns(5).Caption = "îèåôì ò'é"
.Columns(5).Width = 1500
.Columns(6).Caption = "ëåúøú"
.Columns(6).Width = 3350
For i = 7 To 20
.Columns(i).Visible = False
Next
.Refresh
End With
Set TxtDescription.DataSource = rsMain1
TxtDescription.DataField = "Description"
The datagrid works well, but I also want the display to be filtered according to the selection in several comboboxes and DateTimePickers located in the form. For instance, closing the recordset, changing the date in the control DTPToDate and passing the new date in the corresponding parameter doesn't have any effect: the recordset is opened with exactly the same records as before. Nor does changing the value of bStatusType to True nor False (records with all values continue to be displayed).
How should I work to achieve filtering? Should I filter the recordset one opened with all possible records? I'd rather open a new filtered recordset passing the proper parameters!
TIA
Display Grand Total Field At Datareport
how to display the grand total field at the datareport??actually i already have the grand total result,just that i can get the report display i wish to have.
i post the image file for the report i wish to have.
thanks for help
Edited by - monchichi on 6/29/2007 8:35:16 PM
Adding Recordset Between Existing Recordset.
How do i add a new recordset between two that already exists. I dont want to use the Addnew in the EOF. Using a Datacontrol. Question two: How do i move one recordset for example move recordset nr 12 to recordset nr 10. "sorry for my bad English".
Adding Serial No For Datareport
hi,
i have a problem in giving the serial no in datareport. for example when i click the command button to get a datareport i get say 50 records. now i want to add serial no for them from 1 to 50 . please help
thanks in advance
Adding A Function In A DataReport
How can I make a rptTextBox in a Detail Section that would make multiply a column with a Variant(provided by the User in a previous form or Inputbox)? Please help me with this, and I will be forever in debt to you!
Assign DAO Recordset To DataReport
I need to assign DAO recordset to a Datareport at runtime, the problem is DataReport can take ADO recordset only and I have to use JET engine.
can anyone guide me to the right direction to generate a report using JET engine?
Thanks!
Shape A Recordset For Datareport
Hi,
I want to create a datareport using standard ADO recordset (so NOT by using the dataenvironment).
I want to have a recordset with the customers name as a group header, and the customers orders as the details.
But how do i do that? i know that i have to use the Shape command, but the documentation i find in MSDN doesnt work for me. Is there someone who can help me out here?
Thanks in advance, Peter
|