Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Display Total In Datagrid Footer/last Row


hi i got a problem on how to display the total value of the records in each record from a database. i have populated the datagrid with the records from the database, but i dont know how to display the total amount in the last row of the datagrid.
please help..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Total In The Page Footer
I want to know how i can put in the page Footer a summary for page.... I don'nt know if I need to build a formula to accomplishment this..

Thanks for advance for you help

Bye

Total Summary In The Page Footer In Crystal Report 8.5
I want to know how I can put in the page Footer ina Crystal Report 8.5 Report, a Total summary for page.... I don'nt know if I need to build a formula to accomplishment this..

Thanks for advance for you help

Bye

How To Display Group Footer At Bottom Of Datareport
In my datareport I want to display the group footer at the bottom of the page. But it appears at the end of the details section. How can I do that? I cannot use the page footer because the group footer has an aggregate field which will be different on each page of the report.

Display Header/Footer In Rich Text Box Control
I am currently working on a project which converts .rtf file to images eg: .jpg, .bmp. Everything is done. My project converts normal .rtf files (with no header or footer) correctly, but problem occurs when an .rtf file with header/footer comes into focus.

At very first i display .rtf file in Rich Textbox Control and then from there i convert it into image. But the problem is that Rich Textbox Control displays .rtf file but doesn't display Header/Footer, so my applicatoin proceeds with header/footer.

Please help me guys

Display Total ...
guys i m new to XtremeVBTaLK .. n i m new to VB .net realy need ur help ...

i want to calculate the data from access and display the total on textbox how do i do it .. please help me .. please

How To Display A Total In The Last Row Of A Listview
Hi All,

I have a listview with about 30 rows. I have populated the listview with records from my database and depending on my recordset returned there could a be different number of listitems in the listview.

I have a Total Job Cost column with a cost for each job done on an item. I want to add the totals for each job and display it in the last row. Is this possible?

Using A Msg Or Txt Box To Display A Running Total To User
Hello...

I would like to know how to (or if I can) use a Message or Input box to display the following meassage to the user: "You have saved ?? records"... with the ?? of course representing a running total of how many records have been saved. Can this be done with either of these controls or do I need to stick to the userform with a textbox that I'm currently using for this?

Thanks..

Problem When Display Total Of Value If Value Is Null.
Hi,
I have 3 textbox for Price and 1 label to display it's total. This is my code,

Code:
Private Sub Form_Load()
Dim Tot As Currency
Dim text_1 As Currency
Dim text_2 As Currency
Dim text_3 As Currency

.........................
.........................

text_1 = txtFields(0).Text
text_2 = txtFields(1).Text
text_3 = txtFields(2).Text

Tot = text_1 + text_2 + text_3

lblTot.Caption = Format(Tot, "Currency")

mbDataChanged = False
End Sub
It works if only all the textboxes have a value. Any idea? Is there any way that i can total the value wheter it is null or not?
thanx in advance..

Problem When Display Total Of Value If Value Is Null.
Hi,
I have 3 textbox for Price and 1 label to display it's total. This is my code,
Code:
Private Sub Form_Load()
  Dim Tot As Currency
  Dim text_1 As Currency
  Dim text_2 As Currency
  Dim text_3 As Currency
      
  .........................
  .........................
    
  text_1 = txtFields(0).Text
  text_2 = txtFields(1).Text
  text_3 = txtFields(2).Text
    
  Tot = text_1 + text_2 + text_3
  
  lblTot.Caption = Format(Tot, "Currency")

  mbDataChanged = False
End Sub


It works if only all the textboxes have a value. Any idea? Is there any way that i can total the value wheter it is null or not?
thanx in advance..

Total In Datagrid
can somebody tell me how to add total column in a datagrid
say i want to get total in column 2 of the datagrid

DataGrid Total
Heloo.


I am using the code belwo to calculate the total of a column in a datagrid, it works OK, but when the datagrid reaches hundreds of records, it display the below error message. I have to maximaize the datagrid to the highest in order for this code to work, otherwise this error message will appear with a few records.

Error Message

Invalid Row Number
======================


Code Used:

Dim total1


For i = 0 To DataGrid2.ApproxCount - 1
    
    DataGrid2.Row = i
    
   
    DataGrid2.Col = 1
        
        total1 = Val(total1) + Val(DataGrid2.Text)
Next

Text8.Text = total1


Thanks

How To Display Total Item In Listbox Automatically?
hi all .could any one show me how i can display total nubmer of items in list box automatically when listbox get loaded with data.Thanks

How To Display Comma For Total While Adding A Record Itself
Hai friends,

    Good Morning to 1 & all.
    
    I want to store captial alphabets to my database. so that, if the user enters small alphabets, while printing, it will display all the letters in caps only
 
Can any one help me

Regards

Geetha

Edited by - Geethahiren on 6/10/2005 12:28:49 AM

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

Datagrid Column Total
Hello
Any One Help Me?
I have 4 columns in grid
1 itemname
2. Price
3 Qty
4 Amout
I want to amout = price*Qty at time of type value

DataGrid Column Total
Hello
Any One Help Me?
I have 4 columns in grid
1 itemname
2. Price
3 Qty
4 Amout
I want to amout = price*Qty at time of type value

Total Sum Of A Datagrid Column
 Hi All

I have a datagrid attached to an dbase app I am working on, the last column has a price value and I would like to create a total value for this column in a label or text box. I was searching back the old posts looking for some pointers or a code snippet that would do this but was unable to find anything.

Any help appreciated

Thanks

Rob



 
 

Datagrid - Return Total Rows
Hi,
I am using a datagrid first-time and simply want to return the number of total records. Its only one column and I want to get a row count.

something like statusbar.simpletext = Their are 200 records in this datagrid.

Any help appreciated.
Thanks.

Total Currency In DataGrid Column
Here is the code I'm trying to use to add the currency in Column1 of a DataGrid and have it show in the txtTotal.Text textbox. I have used this a couple of years back so I just copied the code but am now getting an error here

dSum = dSum + rs("Total2")

It has something to do with rs("Total2")
Would appreciate any and all help

========================================
Dim fmtCurr As New StdDataFormat
fmtCurr.Format = "Currency"
Set DataGrid1.Columns(1).DataFormat = fmtCurr
Dim rs As ADODB.Recordset
Dim dSum As Double
Set rs = Adodc2.Recordset.Clone
rs.MoveFirst
Do Until rs.EOF
dSum = dSum + rs("Total2")
rs.MoveNext
Loop

Set rs = Nothing

txtTotal.Text = dSum
===========================

Thanks

DataGrid Total Column Count
Here is a question in VB6 you could do something like this to go through all the cells in a MSHFlexGrid1


PHP Code:





 With MSHFlexGrid1
      For iCol = 0 To MSHFlexGrid1.Cols - 1
        If iCol = 1 Then
          mstTitle = .TextMatrix(iRow, iCol)
        End If
        If iCol = 2 Then
          mstDescription = .TextMatrix(iRow, iCol)
        End If
        If iCol = 13 Then
          mstRecordID = .TextMatrix(iRow, iCol)
          GetRecordID
        End If
        stColumnHeader = MSHFlexGrid1.ColHeaderCaption(0, iCol) & ": "
        stDisplayText = stDisplayText & stColumnHeader & .TextMatrix(iRow, iCol) & vbCrLf & vbCrLf
      Next
    End With 







Now in VB.NET I am trying to do something like that when a user clicks a cell in a DataGrid.


PHP Code:





 With DataGrid2.Item(iCol, iRow)
            For iCol = 0 To DataGrid2.VisibleColumnCount
                stColumnHeader = DataGrid2.CaptionVisible.ToString & ": "
                stDisplayText = stDisplayText & stColumnHeader & DataGrid2.Item(iRow, iCol) & vbCrLf & vbCrLf
            Next
        End With 







But in this line "For iCol = 0 To DataGrid2.VisibleColumnCount" instead of DataGrid2.VisibleColumnCount I want the total column count any ideas?

Currency Total From Datagrid Inserted Into Txtbox
I have a datagrid that the user can edit, delete. add etc and it works fine.

The total from one currency column needs to be automaticly updated after the user makes changes and he clicks a Save cmdbutton. At the moment with this code I can only make it work by using a seperate command button to update the total. I would like to do it without using a cmdbutton to update the total. The error I get if I include the code anywhere else is you cannot add a empty row. Hopefully someone can show me how to modifiy this code.


VB Code:
If Adodc2.Recordset.RecordCount <> 0 And Adodc2.Recordset.BOF = False And Adodc2.Recordset.EOF = False ThenDim fmtCurr As New StdDataFormat fmtCurr.Format = "Currency" Set DataGrid1.Columns(1).DataFormat = fmtCurr Dim rs As ADODB.RecordsetDim dSum As DoubleSet rs = Adodc2.Recordset.Clone  rs.MoveFirstDo Until rs.EOF    If IsNumeric(rs("ValueChgOrder")) Then _            dSum = dSum + rs("ValueChgOrder")        rs.MoveNextLoop Set rs = Nothing txtTotal.Text = FormatCurrency(dSum)ElsetxtTotal.Text = "" End If


Thanks for any help

How To Display Comma(,) For Total While Adding,Searching,Printing Using Crystal Report
Hai Friends,

    Good Morning.

While Adding a record, i am in need of my total to be displayed as 11,20,990.80 like that. for that i used, Code:'" & Val(Format(Trim(Textnetamt), "#####0.00")) & " '. While adding a record its showing me comma's but its displaying as 1,120,990.80 which i want that to be displayed as 11,20,990.80 (as this is our format of specification for the totals).

    Also, while searching its not displaying comma's for me.

And Another major problem is with Printing Crystal Report.

Can any one rectify me.

I hope , in printing, we have to do some coding for Customizing in the Format Field of the Net Amount Text.

is that so,

help needed




Regards

Geetha

Report Footer/ Page Footer
I am using Data Reports for one of my Invoicing application.
I need to print the Total Amount always at the end of the report. I have placed the controls in the Page Footer section of the report, but if my report is greater than One page then it prints the Total Amount on all the pages which I don't want. It should only print at the last page.

If I try to place the controls in the Report Footer section, then it prints the Total Amount when ever the report is finished(middle of the page). But I want this to be printed at the bottom of the page.

I hope you have got the problem.
Anyone pls help...

Thanks in advance..
Rohit

Report Footer / Page Footer
I am using Data Reports for one of my Invoicing application.
I need to print the Total Amount always at the end of the report. I have placed the controls in the Page Footer section of the report, but if my report is greater than One page then it prints the Total Amount on all the pages which I don't want. It should only print at the last page.

If I try to place the controls in the Report Footer section, then it prints the Total Amount when ever the report is finished(middle of the page). But I want this to be printed at the bottom of the page.

I hope you have got the problem.
Anyone pls help...

Thanks in advance..
Rohit

Click Datagrid Row And Display Details To Another Datagrid
hello there..here i need help. i have a datagrid that retrieve data from database.what i want to do with the datagrid is when i click any rows of the datagrid it can display the details of the data (refer to the row that i click) to another datagrid.

is there possible to be done ?

i want to know if there is any procedure that can capture the datagrid row that i clicked

HOWTO Display &"# Current Record/# Total Records&" In Adodc.caption?
I know i can get the # of total records using rs.recordcount but how can i get the # of the current record displayed in some txtfield on the form?

For eg, the current record displayed is the 3rd record out of 10 records. So I want adodc.caption to display "3/10". And when I click on next record on the adodc, the display should be "4/10".

BOF and EOF should be taken care of as well.

Any help is appreciated! Thanks!

[Resolved}DataReport With Sub Total And Grand Total With Out DataEnvironment
rsTotals.Open " SELECT Account_Type, Tax_Type, SUM(Payment)AS Total " _
              & " FROM tbl_TransDetails " _
              & " WHERE Entry_Date = # " & Date & " # GROUP BY Account_Type, Tax_Type ", _
                dbCCP, adOpenDynamic, adLockOptimistic, adCmdText

With rptSumTotals
       Set .DataSource = rsTotals
       
          .Sections("Section1").Controls.Item("txtAccounttype").DataMember = ""
         .Sections("Section1").Controls.Item("txtAccounttype").DataField = rsTotals.Fields("Account_Type").Name
          .Sections("Section1").Controls.Item("txtTaxtype").DataMember = ""
         .Sections("Section1").Controls.Item("txtTaxtype").DataField = rsTotals.Fields("Tax_Type").Name
          .Sections("Section1").Controls.Item("txtTotal").DataMember = ""
         .Sections("Section1").Controls.Item("txtTotal").DataField = rsTotals.Fields("Total").Name
    
   'for sub total
           .Sections("Section7").Controls.Item("fnSumTT").DataMember = "" 'rsTotals
         .Sections("Section7").Controls.Item("fnSumTT").DataField = rsTotals!Total
      'for grand total
          .Sections("Section5").Controls.Item("fnGTotal").DataMember = "" 'rsTotals
        .Sections("Section5").Controls.Item("fnGTotal").DataField = rsTotals!Total
   
         .Refresh
          .Show
giving error: its looking for payment values instead of Total values. so not able to find.
i placed Function control in Group footer section for sub totals and for grand total in Report footer section.
i am not using Data Environment as Data Source.
SQL is good, with out sub and Grand total i am able to print report with Total. after adding Those two function controls i am getting error.
If i assign rsTotals as DataMember "Type Missmatch error"

Help Me, Thanks in advance
>>>>>>>>>>>>>>>>>>>>>>






Edited by - sreddy on 3/24/2005 9:25:02 AM

Sql Datagrid Display
I have this datagrid populated from a table. The table has the following fields :
NameHotel, Period_From, Period_To, price1, Price2

The user should be able to click on the datagrid and the information should come up on labels. The catch is: The same hotel might have more than one period and different periods have different prices 1 and 2 e.g
NameHotel:AnyHotel
period_from 01/01/2002
period_To 27/03/2002
Price1 55
Price2 75

and
NameHotel:AnyHotel
period_from 28/03/2002
period_To 31/12/2002
Price1 65
Price2 85

The dates have been chosen from a dtpicker command, but letīs say the user in
this example wanted four days at price1 from 26/03/2002. that would then be 2 days at 55 and two days at 65.

I would like to have it displayed in the format
NameHotel:

2 days at 55 = 110
2 days at 65 = 130
Total= 240

Any help, please?

DataGrid Display SQL
Using:
VB6.0
MS Access DB
DataEnvironemt

Question:
I have a DataBase with a primary Key of AutoNumbers.
I want a DataGrid to Display all the Records that are Contained in a String.

Example, Instead of the DataGrid Displaying all 1 to 50 Records in the DataBase I want it to Display Records number "1 15 23 37" and those 4 Numbers will be dynamic.

Please tell me what to tell my DataGrid.

Display -ve Value In Datagrid
Hi all,

I am using vb6.0 Access 2003

Is there any way that we can display -ve vaules as -ve values in Datagrid.
Data is the result of a recordset.
The data is result of user input. EX: User looks for amount > 1000 or <-1000 [For amount <0 they enter - sign to indicate]
The program works fine except not displaying -ve sign in front of the -ve amounts.
I know to format currency data.
But it will not display whether it is +ve or -ve value.

Code:
Public Sub DataGridFormat()
    Set sfmt = New StdFormat.StdDataFormat
    sfmt.Format = "#,###,##0.00"
End Sub
......
Set grdEditAmount.Columns(3).DataFormat = sfmt



Hope some one will help me.

..................

It is displaying amounts with - as prefix for negative values. I don't how i missed it.




Edited by - sreddy on 8/21/2008 11:09:14 AM

How To Display A Check Box In A Datagrid
Hi,
I need your help.
I have a datagrid control that bind to a table. There are 3 columns bind to a Y/N column which datatype is char(1).
How can I display those columns in the datagrid as checkbox?

Thank you so much,

ConKi

Display Record Set In Datagrid??
Hi I have the code below that queries a database and creates a recordset from it. The code then puts the FirstName value of the record into a textbox. However I also want to display all the records queried in a datagrid. How do I alter the code to allow me to do this? I have a data grid on the form called datDataGrid.

Any help would be greatly appreciated.

Thanks.

Ben.

'Declares the recordset globally for this form
Dim MyRecSet As ADODB.Recordset
-------------------------------------------------------------------
Private Sub btnNext_Click()

' Moves to next record
MyRecSet.MoveNext

' Puts the FirstName value of the first record into a textbox
Me.txtName.Text = MyRecSet.Fields.Item("FirstName")

End Sub
-------------------------------------------------------------------
Private Sub Form_Load()
Dim MyConn As ADODB.Connection
Dim strName As String

'Creating the connection
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:Documents and SettingsBenDesktopWADE2CourseworkDatabasehogwarts.mdb;"

MyConn.Open

' Creating a recordset from a query
Set MyRecSet = MyConn.Execute("SELECT FirstName, FamilyName FROM Character")

' Puts the FirstName value of the first record into a textbox
Me.txtName.Text = MyRecSet.Fields.Item("FirstName")

' This needs to go at the end because if it is before the selection
' of data from the recordset then it doesn't work.
' MyConn.Close

End Sub

Display In DataGrid Control
Hello everyone! First of all, I apologize profusely if this post makes little sense. It's late and I'm sooooo tired and this silly problem is not helping any.

Anyway, here goes:
I have a Data Grid Control on my form called dgdHistory and Adodc callled adoHistory. My problem is that I have tried to link the Adodc control to my Data Grid Control to display the records but it does not display any records. I know it is pulling and working with the recordset because it calculates the correct totals at the end, but no records are displayed in the Data Grid Control.


Code:

rs.Open strSQL, sConn, adOpenKeyset, adLockPessimistic, adCmdText
With adoHistory
.ConnectionString = sConn
Set .Recordset = rs
End With
Set dgdHistory.DataSource = adoHistory
dgdHistory.Refresh
With adoHistory
Do Until rs.EOF
sngCostTotal = sngCostTotal + rs.Fields("TotCost")
sngRateTotal = sngRateTotal + rs.Fields("TotRate")
intTotMin = intTotMin + rs.Fields("Duration")
rs.MoveNext
Loop
End With
Can anyone see what I am doing wrong?

Datagrid:need To Display Enough Cells
Hi all,

I ran a query and return 0 record, the datagrid only display one blank row.

I like to find out if there is a way to default several blank grid cells when there is no record found?

Thanks in advance


Kim

SQL Searching &amp; Datagrid Display
Hello

I have a program that will print the contents of a datagrid and all works well, I just cannot figure out how to fix my search code.

http://img511.imageshack.us/img511/3760/scottsvx0.jpg

I am trying to make it so when the user clicks "Command1" it will filter out anyone who doesnt have "Box Type" 1 and only show those who do.

The way my code is right now, when i open the debug window, the button does give an output of 1 but it doesnt filter the information shown in the datagrid.

Here is my code:


Code:
Private Sub Command1_Click()

strSQL = "SELECT * "
strSQL = strSQL & "FROM hamper "
strSQL = strSQL & "WHERE [Box Type] = 1 "
strSQL = strSQL & "ORDER BY Forename;"

Dim cn As New adodb.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:databasescotts2.mdb"
cn.Open

Dim rs As New adodb.Recordset
Set rs = cn.Execute(strSQL)

With rs
Do While Not .EOF
Debug.Print (.Fields("Box Type").Value)
.MoveNext
Loop
.Close
End With

Set rs = Nothing
cn.Close
Set cn = Nothing

End Sub

DataGrid Display Question
VB 6 Enterprise, OS = Windows XP Pro

Scenario:
I have a DataGrid that is read only. It can have any number of records(rows). The current "Display" allows 25 rows visible. Therefore, if I have more than 25, I need to use the scrollbar.

I worked out a routine that will print the contents of the complete DataGrid. For example, if the record count = 80, I will get 4 pages of printout ( 3 pages, each showing 25 records, and a 4th page with the balance (5 records),

Problem:
The last page will not only show the last 5 records but it will show the previous 20 (20 + 5 = rows visible).

Question:
Is there any way just to show the last 5 record on the datagrid?

The Code:
' RecordCount = adoTrackSort.Recordset.RecordCount is done in a different sub routine

cdPrint.ShowPrinter
Printer.Orientation = vbPRORLandscape
If RecordCount > 25 Then
ScreenCount = Round((RecordCount / 25), 2)
ScreenCount = Round(ScreenCount)
CountDiff = RecordCount - (25 * ScreenCount)

Else
ScreenCount = 1
End If
If ScreenCount >= 1 And CountDiff > 0 Then
HoldScreenCount = ScreenCount + 1
End If
If ScreenCount >= 1 And CountDiff = 0 Then
HoldScreenCount = ScreenCount
End If
ScreenCount = 1
RowPosition = 1
Do Until (ScreenCount + 1) > HoldScreenCount
' Me.PrintForm
DoEvents
RowPosition = RowPosition + 25
ScreenCount = ScreenCount + 1
dbgTrackSort.Scroll 0, 25
DoEvents
Loop
dbgTrackSort.Scroll 0, (RecordCount - CountDiff + 1)
Me.PrintForm
DoEvents
Call MsgBox("You have " & HoldScreenCount & " Pages of printout for this report.", vbInformation, "Report Pages")

Thanks,
Sam

How Do I Display This Report(datagrid)
i would just like to ask if there is a way to display a whole report plus its "relationship" from the other database table.

im using vb6 and ms access for storage.
datagrid for displaying the data's

if yes please give me some sample of codes so i can have an idea.

Display Records In Datagrid And Others
HI

I want to be displayed records in datagrid. i tried it using given code but it gives error like "rowset in not bookmarkable"

rs3.Open "select * from billauto", cn, adOpenDynamic, adLockBatchOptimistic
Set DataGrid1.DataSource = rs3 ' here it gives error
datagrid1.refresh

and i want to update,delete addnew records directly from datagrid

Please help me

waiting for reply
Thanx a lot

Display Records In Datagrid
hi all,

i want to type some name in my textbox. when i start type something ( i feel in textchange itselft) the datagrid should fill with those records from the table starting with letter i typed in the text box. how can i go about. which grid control is best suit here. i need some suggestions. and the beginning code if possible.

another query is can i able to display the records of two tables in a grid

thanx in advance
saj

ADO - Display Datagrid Or Mshflexgrid
Hello All,

I am using ADO with Access databse.How can I show records of below query in Datagrid or mshflexgrid ? There can one record as well as multiple records against unique mp.regnonew, so I want to display those records. How to set this query to adodc1 when I want to fetch record against unique mp.regnonew.


VB Code:
"SELECT mp.regnonew, pvd.visano, mv.visatype, pvd.visaissuedt, pvd.visavaliddt, pvd.visaissueplace FROM mas_passenger AS mp, pass_visadetail AS pvd , mas_visa AS mv WHERE mp.passid = pvd.passid AND mv.visaid = pvd.visaid AND pvd.deleted = no AND mp.regnonew = '" & lstregno.List(lstregno.ListIndex) & "'"

Display Selection Of A Row In The Datagrid
How do get the Datagrid to highlight the first row of record it's displaying
in code
thks

How To Display A Checkbox In Datagrid
Good morning.
I have a datagrid that bind to a table. The table has 1 column which contains data as either Y or N and has datatype char(1).
How can I present this column in the datagrid as a check box?

In the design time, the property of the datagrid only allow a checkbox that bound to a boolean type col but there is no such a boolean type in SQL Server.

Thank you for your help.
ConKi.

How To Display SQL Result In Datagrid
my sql result is declare as ADODB.Recordset
and now i want to print it out in table form.how?
if there are any method please tell me too

Datagrid Won't Display Data
Set con = New ADODB.Connection
con.ConnectionString = "File Name=" & mstrDatabasePath
'mstrdatabasepath = "C: est.udl"

con.Open
Set rst = New ADODB.Recordset


rst.Open txtSQLString.Text, con, adOpenStatic, adLockOptimistic, adCmdText

Set dbgoutput.DataSource = rst

It just stopped working all of a sudden, syntactically I didn't change anything. The weird thing is I can generate XML, delimited, and HTML based upon the SQL taken from the textbox.

Any idea what might cause this?

How To Display The Particular Record In Datagrid : Vb 6.0
Hi all,
Can anyone tell me how to get a record for particular user or Number
In my sql i,v Pinvoice table following fields
InvNo int1001
ItemNo
001
002
003
Descrption varchar(20)Fan
Chair
Table
Price float
90
100
20
Qty
2
5
10
Gross
180
500
200
so my question is if type the InvNo(1001) in a textbox this all Records(ItemNo,Descrp,Price,Qty,Gross) i need to display in a grid if i type the another Invno then it has to show me the corresponding InvNo whch i specify in the same grid and in below the Grid i need the total for theGross amount , so can anyone tell me how to do this

Problem In Datagrid Display : Vb 6.0
Hi all,
Can anyone tell me how to get a record for particular field, in sql i,v Pinvoice table following fields
InvNo int ItemNo int

Descrption varchar(20) Price float Qty Gross float
1001

090

Fan

30

5

150
1001

080

Table

45

2

90
1002

012

Chair

90

3

270
1002

001

ToolBox

120

1

120

now t want to see the particular invNo details in a datagrid when i type the particular invNo ina Textbox (for example if i type the InvNo -1001 in that textbox the grid shows that 1001 details) what should i do to get the result.
in button click i used this query
sqlstring
sqlstring = "select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=& txtTest.Text"
Adodc1.RecordSource = sqlstring
Adodc1.Refresh
1. "Microsoft[ODBC Driver manager]datasource name not found" so i droped it.
2."Incorrect syntex near&"
3.Method 'Refresh' of object 1Adodc failed"
so i used this way
1. in a Adodc control Recordsource command type AdcmdText i added the following code select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=&
it showed me error msg Incorrect syntex near&" as well page loading & close

so i tried to give the datasource at run time, in a button click event i added this query
plz help me to solve this problem

Display Record On Datagrid
how to display all my records on datagrid ?
i already make the datagrid on my form ( from selecting datagrid component ). but how to define its query source
( i'm using odbc mysql conn) - should i place another component ? what i have to do to make the datagrid display the result of my executed query ?
thanks in advance...

Display Records In Datagrid And Others
HI

I want to be displayed records in datagrid. i tried it using given code but it gives error like "rowset in not bookmarkable"

rs3.Open "select * from billauto", cn, adOpenDynamic, adLockBatchOptimistic
 Set DataGrid1.DataSource = rs3 ' here it gives error
datagrid1.refresh

and i want to update,delete addnew records directly from datagrid

Please help me

waiting for reply
Thanx a lot

DataGrid Display Problem
is there any solution?


Hi

I am using VB, COM+/MTS, ORACLE for application. In VB, to update the records I am using DataGrid with the combination of ADODC.

Table structure is as below
ITEM_MST Table
        CODE
        BRAND
        DESCRIPTION

ORDER_MST Table
        CODE
        ITEM_CODE
        QTY
        UOM

Code:
Set objclsPR = New clsPR
Set ADODC1.Recordset = objclsPR.GetRecorset(dblCode)
Set objclsPR = Nothing
DataGrid1.DataSource = ADODC1


Quote:Class Module
Public Function GetRecorset(Optional ByVal Code As Double) As ADODB.Recordset
    On Error GoTo errHandler
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    strSql = "SELECT * FROM ORDER_MST "
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    Set cn = New ADODB.Connection
    cn.ConnectionString = CONNECT_STRING
    cn.Open
    
    rs.Open strSql, cn, adOpenDynamic, adLockOptimistic
    
    Set rs.ActiveConnection = Nothing
        
    Set GetRecorset = rs
    
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
    
    If Not mobjCtx Is Nothing Then mobjCtx.SetComplete
    
    Exit Function
errHandler:
    If Not mobjCtx Is Nothing Then mobjCtx.SetAbort
End Function




clsPR is class, objclsPR.GetRecorset is returning the recordset and this recordset i am binding with DataGrid.

I have 6 columns in DataGrid for display.
1.Code
2.Item Code
3.Brand
4.Description
5.Qty
6.UOM

I donot have any problems with columns Code, Item Code, Qty. My Problem starts with BRNAD and DESCRIPTION.

How do I show the BRAND and DESCRIPTION against the selected ItemCode?

If need more explanations, pls ask.


KT





Edited by - Kshitij on 1/28/2004 6:05:11 AM

Copyright Đ 2005-08 www.BigResource.com, All rights reserved