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




Display Fresh Data On Datagrid


Hello, I'm deleting (recordset.delete) certain rows shown through a datagrid control.When i click update (recordset.update), the datagrid doesn't show the updated record and it will load & show the updated record only when i unload and reload the form, or when the form is "reActivated". I'm trying to use "datagrid.rebind" command to refresh the datagrid,but nothing happens.I'll have to unload and load the form again to display fresh data on the datagrid, but i know there is a right way to do this.Can somebody please tell me how?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Fresh Newbie Again - Form / Data
Hi All,
I have a form with datagrid, dbcombo and ado1 and ado2 ctrls on which access a ms access database to display data. The ado1 control selects the record okay and the corresponding record in the datagrid is highlighted at the same time. The controls are set up as described in the help file. The problem is that I want to have the records in the datagrid window grouped together ie all records with the same type as ado1 should be displayed in datagrid (the type field is hidden as it is not required to be seen again)and no other until the type is changed in ado1. I would also like to be able to display the list of type in the combo box which is where I would really like to select the type rather than ado1. I have put up a screen shot to show what I mean, the code would be standard at the moment so there is no clue there.

I hope that it is not too confusing to you all (just me).

Regards

RBG

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?

Datagrid And Extern Data Display
I've a datagrid and i want
to display Column 7 in a textbox
if row is changed

and if the textbox changes
i want to save it into the
datagrid

my datagrid is bound on a recordset

how could i do this?

How To Display Data In DataGrid Control
please tell me how to display data in DataGrid control, the simplest way to do it. please this is very urgent to me

Datagrid To Display Data From Two Tables
Hi,

I am trying to display data from two tables in the one datagrid using an ado data control. The first table is expenses and the second is rates and they are joined by rateid. The trouble is I wasnt to show expenses for just one employee..

Having major difficulty. Any help would be appreciated.

Display Data From Datagrid To Textbox
i want to know on how can i simply display the data in datagrid in the textbox.for example the user will click on one item in the datagrid and then all the data from the row will be displayed in each of the textbox that i've assign for each of the fields in the recordset.help me..tq

Datagrid Doesn't Display Data
Hi there,
I tried to use a datagrid control is to display some
records retrieved from a table but couldn't get it
done.
stmt = "Select itemName, quantityAvailable from
inventory"
set rs = new recordset
rs.open stmt, activeConn,........
datagrid1.dataSource = rs
with rs
if .RecordCount > 0 then
.movefirst
end if
............
In the debugging window, I could see that 16 records
were retrieved but datagrid1 didn't display any data.
Why? And can data be displayed? Anyone has any idea?
Please help.

Jeremy

Determining Data To Display In A DataGrid (VB6)
Hi guys,
i've now got a datagrid which i need to populate with records from a mdb table depending on what is selected in two combo boxes.

I have two combo boxes which display date from and date to and i need some code that puts records into the datagrid between the two dates selected in the combo boxes....so if anyone could help out , i'd be grately appreciative.


Datagrid Display Incorrect Data
I'm stock when my datagrid display only check boxes instead of texts in the datagrid cells. Below are my code that I use to populate the datagrid.

Code:Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:VB ProjectFormPracticeLoginScholarship.mdb"
        Dim strPerSQL As String = "SELECT Personal.SSN, Personal.FstName, Personal.MdlName, Personal.LstName, Education.Status, Education.Rank FROM Personal, Education WHERE Personal.SSN=Education.SSN"
        perDataAdapter = New OleDbDataAdapter(strPerSQL, strConn)
 
        perDataSet.Clear()
        perDataAdapter.Fill(perDataSet, "Personal")

        Dim ts As New DataGridTableStyle()
        dgApplicants.SetDataBinding(perDataSet, "Personal")
        ts.MappingName = "Personal"
        Dim dtColSSN As New DataGridBoolColumn()
        dtColSSN.HeaderText = "SSN"
        dtColSSN.MappingName = "SSN"
        dtColSSN.ReadOnly = True
        Dim dtColFstName As New DataGridBoolColumn()
        dtColFstName.HeaderText = "First Name"
        dtColFstName.MappingName = "FstName"
        dtColFstName.ReadOnly = True
        Dim dtColMdlName As New DataGridBoolColumn()
        dtColMdlName.HeaderText = "Middle Name"
        dtColMdlName.MappingName = "MdlName"
        dtColMdlName.ReadOnly = True
        Dim dtColLstName As New DataGridBoolColumn()
        dtColLstName.HeaderText = "Last Name"
        dtColLstName.MappingName = "LstName"
        dtColLstName.ReadOnly = True
        Dim dtColStatus As New DataGridBoolColumn()
        dtColStatus.HeaderText = "Standing"
        dtColStatus.MappingName = "Status"
        dtColStatus.ReadOnly = True
        Dim dtColRank As New DataGridBoolColumn()
        dtColRank.HeaderText = "Rank"
        dtColRank.MappingName = "Rank"
        ts.GridColumnStyles.Add(dtColSSN)
        ts.GridColumnStyles.Add(dtColFstName)
        ts.GridColumnStyles.Add(dtColMdlName)
        ts.GridColumnStyles.Add(dtColLstName)
        ts.GridColumnStyles.Add(dtColStatus)
        ts.GridColumnStyles.Add(dtColRank)
        dgApplicants.TableStyles.Add(ts)

        dgApplicants.DataSource = perDataSet.Tables!Personal

Please help.

Thanks!

Chong

Open A Crystal Reports Report With Fresh Data
Hello all,

Can somebody give me a simple example on how to open a Crystal Reports report in VB6 with refreshed data on it.

Thanks a lot !!

David

How To Display The Data Inputted From A Textbox To The Datagrid?
I'm using vb6. and i'm just wondering how to make changes in a datagrid without binding it to a datasource.


(Moved from VB.NET Forum to VB General Forum - CanOz)



Edited by - pelipe_H on 1/22/2005 1:25:20 AM

Open .csv File And Display All The Data Inside To Datagrid?
hi
what i want to do is i open .csv file and display all the data inside that .csv file to datagrid and refresh the datagrid everytime that .csv file data inside modify?

the problem i face it now display it to datagrid and refresh it?
open file it's ok for me.


thanx a lot.

How To Display Selected Data From Excel To VB(Flexigrid Or Datagrid)
Hi

Can somebody please help me.

I would like to select a range of data from an Excel spreadsheet and display the selected data in either a flexigrid or datagrid in VB. The problem is I don't know how.


Thank you in advance for your responses.

Kind regards

Happy

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

Fresh New.....
hello guys,
I'm a fresh one in VB scripting and i have a small pbm..

Lets say a Vb application that consist of 2 forms, I need to use a variable that is defined in the form1 as an integer (say x), I need to use it in form2, run some calculations on it, change it’s value and still have it with it’s new value when I unload form2 and go back to form1.
I tried defining it as a global variable but that didn’t work…when ever i try to ref to this (x)var out side it's parent form (form1), the other form doesn't recognize it...
???where should i have it defined to gain access to it from any form???

Fresh Start To CR 11 Dev Ed....
Hi,

I have just downloaded and installed the Crystal Report 11 Dev Ed product. On the other hand, I have developed a project with VB 6 & MS ACCESS 2000 (as the database with password protection). The only thing remaining is to create a couple of reports for my project.
After installing & getting the CR11 to be integrated into Visual Studio 6, I have selected the folowing items in the VB6 IDE
These are:

-->References window:
1. Crystal ActivX Report Viewer Library 11.0
2. Crystal Reports ActivX Designer Design and Runtime Library 11.0
3. Crystal Reports ActivX Designer Runtime Library 11.0

-->Components -> Controls window:
1. Crystal ActivX Report Viewer Library 11.0

-->Components -> Designer window:
1. Crystal Reports 11


I have also tried the built-in wizard (from within CR11) that automates the process of report creation. But this automated process is ok for situations where no specific criteria is required to query records from the database, and instead just to simply list all the avialable records of a table.


QUESTION:
---------
1. Do I use the same database connectivity code from the VB6 IDE's
code view (that was used for my project) to connect & create
reports in CR11 ?

2. Should the report be designed from:
(a) within CR11 OR....
(b) from the Project Explorer in VB6 IDE and
selecting to add the Crystal Reports module OR....
(c) purely from VB6 code ?

3. How do I provide specific deciding parameteres, upon which
records would be queried ?

Any assistance & help would be gr8tly appreciated....
----
Regards,
Intellogo

A Fresh Set Of Eyes On My SQL Please
Hello there......why this update statement does not work I have no idea.Below is my code and the debug window print out....

Dim actQry As String
actQry = "INSERT INTO tblMain_ACT_DESC (ORCHARD_ID, NAME, DESCRIP, DATE, SCOPE, ACT_TYPE, VALU_TYPE, REFERENCE, COMMENTS, ACT_LINK)"
actQry = actQry & " VALUES (" & cbox_Orchard & ", '" & tbox_NAME & "', '" & tbox_DESCRIP & "', '" & tbox_date & "', '" & tbox_SCOPE & "', '" & tbox_ACT_TYPE & "'"
actQry = actQry & ",'" & tbox_VALU_TYPE & "', '" & tbox_REFERENCE & "', '" & tbox_COMMENTS & "', '" & tbox_ACT_LINK & "');"

INSERT INTO tblMain_ACT_DESC (ORCHARD_ID, NAME, DESCRIP, DATE, SCOPE, ACT_TYPE, VALU_TYPE, REFERENCE, COMMENTS, ACT_LINK) VALUES (101, 'Grant', 'Grant', '10/5/01', 'Grant', 'Grant','Grant', 'Grant', 'Grant', 'Grant');

The table fields are all text with the exception of ORCHARD_ID=number, Date = short date, comments= memo.....

If anyone sees it I will forever be in your debt

Need A Fresh Perspective
I had this working earlier, but VB6 crashed and I hadn't saved (of course). All my attempts to figure out how I had it before have failed.

The code below is supposed to piggy-back off the SQL Statement and pipe everything that is going to the DataReport also to Text4. What it is doing is only piping the first result and spamming it endlessly.

I'd appreciate a fresh perspective on this, maybe you'll be able to see what I am doing wrong:

Private Sub Command16_Click()

Dim strCR As String

strCR = Form1.Combo2

'close-open the rs to refresh
    
    If DataEnvironment1.rsCommand1.State = adStateOpen Then DataEnvironment1.rsCommand1.Close
    
    DataEnvironment1.Command1 strCR
        
    Do Until DataEnvironment1.rsCommand1.EOF
    
Form1.Text4.Text = Form1.Text4.Text & DataEnvironment1.rsCommand1.Fields("name") & vbCrLf
    
Form1.Text4.Refresh
    Loop
    On Error Resume Next
    
    DataReport1.Show
    
End Sub

HELP!! NEED FRESH EYES!
GOT IT WORKED OUT!! PLEASE DISREGARD.



I am getting an "End of statement expected" error in VB when I try to run this code. Maybe I have been looking at it for too long to see the mistake. Would anyone be so kind, as to, offer any advice/ fresh eyes?

Thanks in Advance!!!

Private Function GetInsertCommand()
        Dim strSql As String
        strSql = "Insert into "Suppliers"("SupplierID", "CompanyName", "ContactName", "ContactTitle", "Address", "City", _
        "Region", "PostalCode", "Country", "Phone", "Fax", "HomePage") Values (@SupplierID, @CompanyName, @ContactName,

_
        @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax, @HomePage)"

        Return strSql
    End Function



Edited by - VBGrrl on 1/23/2005 10:37:03 AM

Need A Fresh Perspective
I had this working earlier, but VB6 crashed and I hadn't saved (of course). All my attempts to figure out how I had it before have failed.

The code below is supposed to piggy-back off the SQL Statement and pipe everything that is going to the DataReport also to Text4. What it is doing is only piping the first result and spamming it endlessly.

I'd appreciate a fresh perspective on this, maybe you'll be able to see what I am doing wrong:

Private Sub Command16_Click()

Dim strCR As String

strCR = Form1.Combo2

'close-open the rs to refresh

If DataEnvironment1.rsCommand1.State = adStateOpen Then DataEnvironment1.rsCommand1.Close

DataEnvironment1.Command1 strCR

Do Until DataEnvironment1.rsCommand1.EOF

Form1.Text4.Text = Form1.Text4.Text & DataEnvironment1.rsCommand1.Fields("name") & vbCrLf

Form1.Text4.Refresh
Loop
On Error Resume Next

DataReport1.Show

End Sub

Fresh Newbie Needs Help With Forms
Hi, I am trying to have a main form open when running the program which works okay and I did have one button working okay but now both buttons do not work (first two).

Main form opens okay

Code:
Public Sub Data_Entry_Click(Index As Integer)
Data_Entry Show
Hide.Me
End Sub
Public Sub Risk_Enquiry_Click(Index As Integer)
Risk_Enquiry Show
Hide.Me
End Sub
Public Sub Exit_Button_Click()
Unload Me
End Sub
the error message

is expected function or variable

I know I must have done something silly because I did have one button working okay with the second button giving an error message and now niether of them work. I am so used to working with access but without the VB side too much that I am lost trying to get this to work. Any help would be greatfully recieved.

Vb6 Dlls On Fresh Windows.
Hy there. i have question or questions. i need to know if "ws2_32.dll" and "MSVBVM60.DLL" are on fresh installed windows, tnx.

I Need A Fresh Pair Of Eyes
Hi,

I'm now using


VB Code:
For loopy = 1 To numberShellExecute Me.hwnd, vbNullString, "C:WINDOWSexplorer.exe", site, vbNullString, SW_MAXIMISENext loopy


However, it is launching the websites fine but is not maximising them - any ideas?

Jord

--------------------------------------------------
...and not for myself

I'm opening up websites using explorer.exe and passing the website as a parameter to the executable. I wish to maximise each window that I open, however, the following code does not maximise any windows.


VB Code:
For loopy = 1 To numberrunner = Shell("C:WINDOWSEXPLORER.EXE " & site, [b]vbMaximizedFocus[/b])Next loopy


I thought vbMaximizedFocus was suppoed to maximise the window, then I thought that perhaps the fact that the windows are opening iterationally (is that a word ?) could cause the window to lose focus before the command can be applied or some other such complication.

Does anyone have any idea why the windows are maximising themselves and if there are any other ways I could maximise them instead.

Jord

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

Need A Fresh Perspective... Before Pulling My Hair Out!!
Hi everyone!

I'm in a rut and am looking for any thoughts you might have...

I have 2 workbooks (we'll call them A & B).

In workbook A, I have a column with names. The number of names can vary, but they will start at the top (row 2) and go down the cells in the column.

What I'm trying to do is have the vba look through the column in workbook A and check if the name exists as a sheet name in workbook B. If it does not, then it will create a sheet by that name. The number of sheets in workbook B may have anywhere from 4 worksheets on up in it.

I know I need some type of good loop statement in it, but I've been struggling with it and can't seem to get it to work. Any help would be greatly appreciated.

-- Jim

Need Fresh Pair(s) Of Eyes On This Problem...
.... I've been looking at this for ages and cannot see what is wrong. I'm getting an error "The select statement contains a reserved word or an argument name is mispelled or the punctuation is wrong".

I've quadruple checked all argument names and they are not wrong. I cannot see any punctuation errors and as far as I know this is a syntactically correct statement with no reserved words. I even tried changing names in the select as to x, y and z incase they are reserved words and the table aliases from sp and fnr to s and f but it still does not run. i cannot think of any more ways to tinker with this to make it work.

Could someone help please ???

my vB code runs it into an access 97 db but I stripped out the sql and tried to debug it by dropping straight into a query in access and it refuses to work.

SQL as follows:

SELECT sp.sp_surname_text as name, sp.sp_initials_text as initals, fnr.description as rank
FROM service_personnel sp, full_naval_rank fnr
WHERE sp.sp_service_number = 'D252182R'
AND fnr.identifier = sp.sp_rank_code
AND fnr.effective_date <= #2004-03-23#
AND (fnr.end_date > #2004-03-23# OR fnr.end_date IS Null)

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

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

DataGrid-Display Problem
Hi,

Iam using DataGrid in my application to display the search results.
with Database as MsAccess.

i have used code like this

    rsVS.Open "select Voter_ID, Name, Father_Name, Village, Taluk from PersonnalDetails1 where ID between val(me.txtFrom.text) and val(me.txtTo.text) ", dbVS, adOpenStatic, adLockOptimistic

    Set Me.DataGrid1.DataSource = rsVS


I have my data base column declred as Number


The error message iam getting as Too Few Parameters Expected3

Thanx

DataGrid Click-Display
HI,

Iam Using DataGrid in my application. I got the Datagrid Display.
The First column is my Primary Key, so that i can search the database based on this key.

Now upon clicking any where in the row i want to display the details in another form.
How to go about it.

Thanx,
harry

Problem With Datagrid Display
im using an adodc to display sql queries in the datagrid...this is the sql i use to get my data

SELECT @total:= SUM(i.itemQty) FROM invoiceItemTable i, invoiceTable t, partsTable p WHERE i.itemNum = p.partID AND i.invID = t.invID;
SELECT p.partName as 'Item', SUM(i.itemQty) as 'Quantity', CONCAT((ROUND((SUM(itemQty)/@total)*100)),'%') as 'Percent' FROM invoiceItemTable i,partsTable p WHERE i.itemNum = p.partID AND i.invID = t.invID GROUP BY p.partName;

my concern is that i can't seem to display the third column of my query which is suppose to be the percentage...so far the first two columns of the query displays normally...and i doubt my query is wrong because when i use the same query to print it in the data report...it works fine...

so my question is...why can't i display the thrid column in the datagrid? is there some formating required or something? as far as i know sql queries only return strings right? so there should be no problem in displaying in the grid....

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