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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using Find Method And Display Result In Datagrid?
I'm just a beginner for this so hopefully you can help me to solve this.
How to display result at datagrid by using find method?
By the way I'm using ADO method to link up the datagrid
Besides that can the result at datagrid be printed out?
Display Result After Searching
i got aquestion that how to display the result on the datagrid after searching.how was the code?(i already finish the SQL statement)the only problem that is how to display on the datagrid.
p/s:i 'm using ADO
Display Result In Another Form
I have to forms. I want to search for a certain record using the first form if record/s exists then the result will be displayed in the second form using mshflexgrid.
[highlight=VB]
With MyRs
.Close
.Open "SELECT LName,FName,MI FROM Borrowers WHERE LName = '" & TxtStudLName.Text & "' & FName= '" & txtStudFName.Text & "' & MI=' " & txtStudMI.Text & "'", .ActiveConnection, .CursorType, .LockType
'MsgBox (TxtStudLName.Text & txtStudFName.Text & TxtStudMI.Text)
End With
frmsecondform.????
[highlight=VB]
am i on the right track?
Display Result In List...
Hi all, can someone provide me some code how to display Result in List?
These what I have;
- intID(10)
- strName(10)
- intTotal(10)
- strGrade(10)
- LstResult
Thanks.
Display Query Result Set?
Hi,
How do I display a query result set in Access?
My query outputs a bunch of rows...how do I display it on a screen?
thanks
cus129
Display Result Of Function
Hello All,
I have just completed 2 MS courses on VB.Net and I am pretty confused on functions. I am creating a timesheet. I have textboxes for regular hours, vacation hours, and so on. I created a function to calculate the sum of all textboxes. I am calling that function from a click event. I keep getting a "0" as total hours. My code is below if someone would be kind enough to guide me. I have been working on this for a few days now and am getting frustrated....
Imports System.Drawing.Printing
Public Class Form1
Inherits System.Windows.Forms.Form
Dim RegularHours As Integer
Dim OTHours As Integer
Dim VacationHours As Integer
Dim SickHours As Integer
Dim PersonalHours As Integer
Dim OtherHours As Integer
Dim TotalHours As Integer
Public Function Get_TotalHours()
Dim RegularHours As Integer
Dim OTHours As Integer
Dim VacationHours As Integer
Dim SickHours As Integer
Dim PersonalHours As Integer
Dim OtherHours As Integer
Dim TotalHours As Integer
TotalHours = RegularHours + OTHours + VacationHours + SickHours _
+ PersonalHours + OtherHours
txtboxTotalHours.Text = TotalHours
End Function
Private Sub btnTotalHours_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTotalHours.Click
'Instruct form to call function TotalHours and display the sum in Total Hours textbox
Dim TotalHours As Integer
Get_TotalHours()
txtboxTotalHours.Text = TotalHours
End Sub
Public Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'Instuct form to clear all text boxes and combo boxes
cboboxEmployee.Text = ""
cboboxDepartment.Text = ""
txtboxRegularHours.Text = ""
txtboxOTHours.Text = ""
txtboxVacationHours.Text = ""
txtboxSickHours.Text = ""
txtboxPersonalHours.Text = ""
txtboxOtherHours.Text = ""
cboboxOther.Text = ""
txtboxNotes.Text = ""
txtboxTotalHours.Text = ""
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
'Instruct form to close when done button is clicked
Me.Close()
End Sub
Thank you ahead of time for any and all help!
Need Help On How To Display A Result On Multiple Form?
Hi
I have two forms in my project in visual basic 6. One form (Main form) is to process the data and the other is for displaying the results ( Display form). I want to display the results on the Display form after I processed the data on the Main form, but I don't know how to do it. Please I need some one's help to show me how to do it.
I appreciate
biruk
Query Result Container Not For Display
Hi All,
Here's the problem : I'am building a vb6 application that uses a .dll wrapper for sqlite to access two sqlite database. My query results (SELECT) are returned in a Variant variable. I would like to add my result to an organized object like a recordset or a datagrid BUT I dont want to display the results. I am building a class not a form, so what I'm really looking for is an object in wich I could initiate columns with proper column name and then add my data rows. That way I will be able to browse my result using the row index and the field name.
Is there an unbound object that doesn't have to be on a form that I could use?
thanks a lot for your help
Help~!dbgrid-it Display Incorrect Result~~
Im new to VB. Im now doing an assingment for me and facing problems now....>_<
I want to search a particular record from a table.
I serch by ID.When i click Serach button, it should display the record info in form of label.
but the result i get, it display the 1st record no matter which ID i serch for. In the DBGrid, it show all the records....
following is my code...
**********************************
Private Sub cmdMSearch_Click()
Dim pstrSQL As String
If txtMenuID.Text <> vbNullString Then
pstrSQL = "SELECT * FROM menu WHERE mID =" & txtMenuID.Text
datMenu.RecordSource = pstrSQL
dbgMenu.Refresh <===Notes***
lblAID.Caption = dbgMenu.Columns("mID")
lblADesc.Caption = dbgMenu.Columns("mDesc")
lblACat.Caption = dbgMenu.Columns("mCategory")
lblAPrice.Caption = dbgMenu.Columns("mPrice")
End If
End Sub
*************************
For the [Note***] line, i found in my text book, it wrote it as
datMenu.Refresh
When when i followed it, it got error.(so i modify myself ;p )
%%%%%%%%
For Another question....
I want to add new record into the database using textbox & Add button, how to do it?
Thx a lots ....
Datagrid Result Always Be Same
why the datagrid result always no refresh when i click the sort button. But if i add the Adodc1.Refresh and the program show error at that line.
Quote:
Option Explicit
Dim strSQL As String
Private Sub Command1_Click()
strSQL = "SELECT * FROM [user] order by Ic_No Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command10_Click()
Unload Form2
Form2.Hide
Load Form1
Form1.Show
End Sub
Private Sub Command11_Click()
End
End Sub
Private Sub Command2_Click()
strSQL = "SELECT * FROM [user] order by first_name Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command3_Click()
strSQL = "SELECT * FROM [user] order by last_name Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command4_Click()
strSQL = "SELECT * FROM [user] order by Gender Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command5_Click()
strSQL = "SELECT * FROM [user] order by age Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command6_Click()
strSQL = "SELECT * FROM [user] order by address Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command7_Click()
strSQL = "SELECT * FROM [user] order by city Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command8_Click()
strSQL = "SELECT * FROM [user] order by state Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Command9_Click()
strSQL = "SELECT * FROM [user] order by zipcode Asc"
Adodc1.RecordSource = strSQL
End Sub
Private Sub Form_Load()
End Sub
How To Display Stored Procedures Result In ListView?
Hello! Does anybody know how to display a stored procedure result in listview?
I have this in my code:
Dim li As ListItem
Set cmdActLog.ActiveConnection = connActLog
Set rstActLog = cmdActLog.Execute
li.SubItems(2) = rstActLog
But I"ve got an error that says type mismatch. Any idea?
Thanks!
Display Result Of Function As Label On Userform
Hello,
I am trying to display the result of a custom VBA function as a label on a userform. The function is called and takes arguments from three text boxes on the userform. I attached it to the exit parameter. (This may be part of the problem; I'm not sure).
There seem to be two problems, first all the text boxes don't always contain data, but because the arguments are not optional, I get a type mismatch error when the code runs (I tried switching some of them to optional, but it didn't help as you can see from my 'commented code).
The other problem is that even when all the arguments seem to be met (i.e. the text boxes all have data), I still get a compile error that the argument is not optional. This only happens if I try and pass the result to some aspect of the userform. As you can see from the last coded line in the custom function, if I assign it to a range on the worksheet, it functions fine.
Below are the codes. Any help you can provide would be appreciated. I use excel 03 and windows XP.
Note the exit procedure also contains a code that formats the text box to a specified date format, and this does work.
Code:Private Sub txtStartDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim StartDate As Date
Dim EndDate As Date
If IsDate(Me.txtStartDate.Value) Then
StartDate = Me.txtStartDate.Value
Me.txtStartDate.Value = Format(StartDate, "m/d/yyyy")
Else: MsgBox "Please enter a date"
End If
Call CalcDate(txtStartDate, txtYears, txtMonths, txtDays)
EndDate = CalcDate
lblProjectPeriod.Caption = EndDate
End Sub
and the custom function:
Code:Function CalcDate(StartDate As Date, Optional Years As Variant, Optional Months As Variant, _
Optional Days As Variant) As Date
'If IsMissing(Years) Then Years = False
' If Years = False Then Years = 0
' End If
'End If
'If IsMissing(Months) Then Months = False
' If Months = False Then Years = 0
' End If
' End If
' If IsMissing(Days) Then Days = False
' If Days = False Then Years = 0
' End If
'End If
CalcDate = DateAdd("yyyy", Years, StartDate)
CalcDate = DateAdd("m", Months, CalcDate)
CalcDate = DateAdd("d", Days, CalcDate)
CalcDate = DateAdd("d", -1, CalcDate)
'Range("L7") = CalcDate
Thanks for your help
Problem To Display Query Result By Week
Hello there,
My problem is this. I have an access query to display sum(amount) by month. I want to do the same by week. Is there a query syntax available to do this? If it is not possible,
1. Can I determine the start & end dates of all the weeks for the month through code? I can then pass these dates to the query and display sum(amount) for each week.
Thanks if someone can help.
Search Result In Datagrid
i want to create a search form that will show the search result in datagrid when a data is typed in a text box and search button is clicked..
i know its easy but i cant ..as i m new with vb but familiar with sql commands.
heres a part of the code
Private Sub searchitem_Click()
Dim qstring As String
qstring = "select * from items where id = '" + Text1.Text + "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:myVBshopshop.mdb;Persist Security Info=False"
Adodc1.RecordSource = qstring
End Sub
Search Result In Datagrid
i want to create a search form that will show the search result in datagrid when a data is typed in a text box and search button is clicked..
i know its easy but i cant ..as i m new with vb but familiar with sql commands.
heres a part of the code
Private Sub searchitem_Click()
Dim qstring As String
qstring = "select * from items where id = '" + Text1.Text + "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:myVBshopshop.mdb;Persist Security Info=False"
Adodc1.RecordSource = qstring
End Sub
:help:
Search XML File And Display Result In A Grid Or TextBox
Hi,
I have an XML file that looks something like this extract..
<?xml version="1.0" encoding="UTF-8" ?>
<MainRequest>
<cust id="010015000002/2053137DRV">
<ref>205313794V</ref>
<Date>20051231</Date>
<firstName>CATHY</firstName>
<middleName>SUE</middleName>
<surname>PATTERN</surname>
</cust>
<cust id="010016000001/2060954REA">
<ref>7060954762</ref>
<Date>20051231</Date>
<firstName>JOHN</firstName>
<middleName>BRAD</middleName>
<surname>AUXLED</surname>
</cust>
<cust id="010017000000/2051035GF">
<ref>6051035AHT</ref>
<Date>20051231</Date>
<firstName>EMILIA</firstName>
<middleName>DAWN</middleName>
<surname>HOSKIN</surname>
</cust>
</MainRequest>
This file would ultimately hold several thousand records, what I am trying to achieve is on a form have a Listbox, that would hold search criteria....eg search on surnames, or ref..etc etc. Then I wanted the search result to be displayed in a grid or at the worst in a TextBox....but, I need all of the attributes associated with the record to be displayed too!!
Any pointers would be valued.
I have plagerised the following code from this forum ...but it still needs some work to get me to my goal.
VB Code:
Dim oxmlNodeList As IXMLDOMNodeListDim XMLDoc As MSXML2.DOMDocument30Dim intIndex As Integer Set XMLDoc = New DOMDocument30XMLDoc.async = FalseXMLDoc.validateOnParse = FalseXMLDoc.preserveWhiteSpace = False XMLDoc.Load "C:Test.xml" If XMLDoc.parseError.errorCode = 0 ThenIf XMLDoc.readyState = 4 ThenDoEventsEnd IfElseErr.Description = XMLDoc.parseError.reason & vbCrLf & _"Line: " & XMLDoc.parseError.Line & vbCrLf & _"XML: " & XMLDoc.parseError.srcTextErr.Raise 1006End If Set oxmlNodeList = XMLDoc.documentElement.selectNodes("//firstName") For intIndex = 0 To oxmlNodeList.length - 1If oxmlNodeList(intIndex).parentNode.parentNode.nodeName = "cust" Or _oxmlNodeList(intIndex).parentNode.parentNode.nodeName = "MainRequest" ThenDebug.Print oxmlNodeList(intIndex).Text Debug.Print oxmlNodeList(intIndex).nextSibling.TextEnd IfNext Set XMLDoc = NothingSet oxmlNodeList = Nothing
How To Display Text In Result Of An MS Word ADDIN Field?
Hi, everyone,
I get to put some text, such as a record from a database, in an MS Word ADDIN field, then display part of it in the result of that field.
Here is a sample.
The code of an MS Word field like this,
{ ADDIN <name>NaslaN</name><title>programmer</title><address>blah blah...</address> }
And I want that field display it result in a word document like:
(NalslaN, programmer)
Well, I can use the following code to add a field to document,
Code:Sub InsertAField ()
Dim myField As Field
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
Type:=wdFieldAddin, Text:="<name>NaslaN</name><title>programmer</title>" & _
"<address>blah blah...</address>", preserveformatting:=False)
myField.ShowCodes = False
End Sub
But I can't figure out how to set the result of that field to "(NalslaN, programmer)", it always
be empty. I try to use the following code to set the result of that field.
Code:Dim myRange As Range
Set myRange = myField.Result
myRange.InsertAfter "(NalslaN, programmer)"
But the text inserted text appear to be a seperate section, it is not the result of that field, the latter always keeps empty.
Can anyone tell me the answer or give me some hint?
Thanks
Searching DataGrid And Highlighting The Result?
Hello
Here comes another post...
I'm using a JET Database with two tables, fldArtist and fldTitle (the primary key). I connect to the db with an ADO data control. The data is presented in a DataGrid.
My question is... How would I search the grid for a Title and then highlight the row if a result is found? I think I've got the searching part down - it is the highlighting that I can't figure out (or just indicating whether it was found or not in any way). Anyone got any tips?
Here's the code:
Code:
Private Sub cmdSearch_Click()
Dim strArtist As String
Dim strTitle As String
strArtist = txtArtist.Text
strTitle = txtTitle.Text
With frmMain.adoCd.Recordset
.Find "fldArtist = '" & strArtist & "'", , , 1
End With
End Sub
How See Command Parameter Result On Datagrid
hello all,
i have a dataEnviroment(de), with command(cm) where have 1 parameter. when execute command with parameter, de.cm(2) in my datagrid i dont see expected results. my datagrid as datamember="cm" and dataset=de.
i expect to see several lines has result of command execution...
i have tested to see only one record of command execution(first), and using textbox i can see the result.... where's my problem???
thanks
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
Display "Does Not Exist" Upon Search No Result
Hi,
I'd like my search looping in VBA to display a message that says that the
identification written does not exist in the list. Actually, if nothting is found, the code does an error. It must be something like "On Error GoTo MsgBox" To I imagine. But I don't know how to write it.
Thx
Werner
How To Show A Query Result From SQL-server With "compute...by" In A Datagrid?
How to show a Query result from SQL-server with "compute...by" in a datagrid?
for example:
adodc1.recordsource="select name,class,money from student order by class compute sum(money) by class"
datagrid1.datasource=adodc1
After I run it, there is only the data of one class. The other classes and the sum of every class are not shown.can you tell me how to show all the query results in the datagrid?
Thank you very much!
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 && 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) & "'"
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.
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
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....
Display DBF File Into DataGrid
Hi all
i am a complete novice in database programming in VB. I have a DBF file whose location and file name is always constant. I want to display it in a form using DataGrid control. I would appreciate it very much, if someone can point me to proper codes.
thanks a lot in advance
karin
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")
|