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




How To Retrieve & Display Last Record


Hi..may i know how to retrieve the last record from database and displayed that record on form.

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Trying To Input Single Record Number To Textbox And Display Individual Record
Have an input textbox "txtEnterRecNum_LostFocus()", trying to get it so that the user can enter a single record number (1-10) and then THAT one record displays in another textbox "txtDisplayIndividual.Text"

Have coded it to singlely accept one number (for example it is set at number 5), that is ok ... having problems expanding to determine if it's 1,2,3,4,5,6,7,8,9 or 10.

I've played with Do While, Do Until, Ten episodes of IF's (that is long and hokey), tried OR's, tried i <=10, etc., but am not coding correctly as nothing has been successful.

(1) How would I change the following single acceptance code below, to FIRST accept numbers 1,2,3,4,5,6,7,8,9 or 10 and THEN display that particular record?

Code:
Private Sub txtEnterRecNum_LostFocus()
Dim i As Integer
i = 0
Open GetAppPath & "mytext.txt" For Input As #1
Do Until EOF(1)
i = i + 1
Input #1, SampleOutput
If i = 5 Then
txtDisplayIndividual.Text = SampleOutput
Exit Do
End If
Loop
Close #1
End Sub
(2) When it does work for one number, the record displays only if one clicks inside another object/input textbox ... How to make it work no matter where the user clicks on the form?

(3) And how to make it work by pressing ENTER key on the keyboard? (maybe this one is too complicated?)

Entering Record Number And Trying To Display Individual Record
Have an input textbox "txtEnterRecNum_LostFocus()", trying to get it so that the user can enter a single record number (1-10) and then THAT one record displays in another textbox "txtDisplayIndividual.Text"

Have coded it to singlely accept one number (for example it is set at number 5), that is ok ... having problems expanding to determine if it's 1,2,3,4,5,6,7,8,9 or 10.

I've played with Do While, Do Until, Ten episodes of IF's (that is long and hokey), tried OR's, tried i <=10, etc., but am not coding correctly as nothing has been successful.

(1) How would I change the following single acceptance code below, to accept numbers 1,2,3,4,5,6,7,8,9 or 10?
Code:
Private Sub txtEnterRecNum_LostFocus()
Dim i As Integer
i = 0
Open GetAppPath & "mytext.txt" For Input As #1
Do Until EOF(1)
i = i + 1
Input #1, SampleOutput
If i = 5 Then
txtDisplayIndividual.Text = SampleOutput
Exit Do
End If
Loop
Close #1
End Sub
(2) When it does work for one number, the record displays only if one clicks inside another object/input textbox ... How to make it work no matter where the user clicks on the form?

(3) And how to make it work by pressing ENTER key on the keyboard? (maybe this one is too complicated?)

Retrieve Record From MDB
I am trying to look up a record in a MDB file on a button press. I am trying to allow the user to enter the f_id number on the form and then allow them to press a button. On the button press it retrieves the record where f_id = id in the table and populates the rest of the fields so they can edit the record.

Ok I have the following fields on the form
f_id
f_customer
f_colour
f_length
f_width
f_height

the MCDB is called: test.cdb
the Table is called: tbl_taginfo

the fields in the table are as follows:

id (which = "f_id" on the form)
customer (which = "f_customer" on the form)
colour (which = "f_colour" on the form)
Height (which = "f_height" on the form)
Length (which = "f_length" on the form)
Width (which = "f_width" on the form)

I have no ideas here on how to do it and I have looked all over the net for examples with no results, can someone give me some idea on how to do this.

Thanks in advance.

Cheers
zeroanarchy

How To Retrieve The Resolution Of A 2nd Display
Hi,
I want to check if there is a 2nd display and if so what resolution it has.
Are there any apicalls for that?

Thanks

Hoe To Retrieve A Record Number?
How can I retrieve a record number?

lets imagine:


Code:
RecordNumber Name Age
----------------------------------------
1 John 15
2 Ann 23
------------------------------------------
how to print in a txt box or something that "John's" current record number (1)?

tks 4 ur attention

How Can I Retrieve My SQL Database Last Record?
How can I retrieve my SQL database last record?

I got a database...

|EmployeeNo | EmployeeName|
100011 Liu
100012 Sherry
100013 Vinci


I want take the employeeNo column last value... how can I do it??

Retrieve Last(latest )record
i have a table with two field field1 and field2.
where field2 is the latest date capture whenever a record is inserted..
How do I code in SQL to retrieve the lastest record (by the last row and not the lastest date) as there may be many records inseted during a date..

SELECT field2 from table where....????

Retrieve Record Into Combo Box
Hi All,
I don want to hard code all record in combo box. All i need to do is,
to load every record which store in database(access) into the the combo
box on run time. But i get run time 383 - text property is read only
(which highlighted in line with blue). Can somebody help me? Thanks.

Private Sub Form_Load()
Dim rstLoad As ADODB.Recordset
Dim strLoad As String
strLoad = "select * from Agent"
Set rstLoad = New ADODB.Recordset
rstLoad.Open strLoad, conn, adOpenKeyset, adLockPessimistic, adCmdText

With rstLoad
If (.EOF = False) Then
ProbLog.cmbAgent = !AgentCode
.Close
Exit Sub
End If
End With
End Sub

Rgds,
Khai Sze

Retrieve Record From Database
i encounter run time error on the
"RecordsetDB.Open sSqlStatement, ConDB, adOpenStatic, dLockOptimistic"
pls help me to look through where get wrong


Quote:





Dim RecordsetDB As ADODB.Recordset
Dim ConDB As ADODB.Connection
Dim sCol1 As String
Dim sCol2 As String

Set ConDB = New ADODB.Connection
Set RecordsetDB = New ADODB.Recordset

ConDB.CursorLocation = adUseClient
ConDB.Open GetConnection

RecordsetDB.Open sSqlStatement, ConDB, adOpenStatic, dLockOptimistic

With RecordsetDB
If (.BOF And .EOF) Then
MsgBox "no record found"
Else
Do Until .EOF
sCol1 = .Fields("Col1")
sCol2 = .Fields("Col2")
.MoveNext
Loop
End If
End With

RecordsetDB.Close
ConDB.Close
Set RecordsetDB = Nothing
Set ConDB = Nothing

How To Retrieve Picture Path And Display It?
dear all,
i want to make one button can appear all directory in my computer and it just can recognize image file.

once i click a file,the picture can display in picture control.
is app.path can be used here?

my plan is i will save the path in my database ( not the picture).

for your information, i use VB 6 and microsoft access 2002.

thanks in advance for your help

Retrieve Txt File And Display In Listbox, Help Plz
Ok im making a RPG based off vbGORE, and im editing the login screen to display news. To do this i want it to retrieve a txt file from my website, and display it in a listbox. Can you guys help me out with this

Retrieve Record On Button Press
Hi all,

I have an MSAccess database and was wondering how I can access a specific record by clicking a command button. I have a few buttons in a control array and depending on the index I'd like it to retrieve a corresponding record in a table.

I'm not sure whether ADO or DOA access methods are best. I'd appreciate your help.
I can't find any code examples of what I want.

Many thanks

Retrieve And Use Autonr In Same Record In MSQL
Hi guys,

I've searched this forum for answers but can't find any that correspond 100% to my problem.
Here's the issue: I use in my vb 6.0 program a sql statement to add products to my producttabel. One of the field contains a link to a picture. The name of the picture is based on the autonumber. For example: when a new product is created with autonr 1234, the name of the picture is 1234.jpg and the link to that picture would be c:1234.jpg.

What i want to do is to be able to write 1 sql statement to insert the data using the autonr of that same record to create a link to the correct picture.

I'm not able to read the filename of that picture as an alternative because the pictures doesn't exis yet at the time the insert.

Here is my sql statement (it does not contain the autonr yet):


Code:
sSQL = "INSERT INTO producttabel (Artikel, Toestand, Prijs, Aankoopwaarde, Aankoopcode, ;" & _
"BoekhoudkundigeCode, HuurPrijs, HuurCode, TransportCode, InstallatieCode, Foto1, ;" & _
"ContactID, Online);" & _
"VALUES ('" & oExcel.Cells(rij, 3) & "', 'Goed', '" & oExcel.Cells(rij, 11) & "', '0', '1', '1', ;" & _
"'Niet te huur', '1', '1', '1', 'f1', 'HERE I NEED TO INSERT THE AUTONR', '1', '1' )"

Any suggestions would be appreciated.

Thanks.

Regards,

Crash-override

Retrieve Data And Display It On Form Layer
I don't really know how to explain it in words but I was hoping you guys can help.

What I am trying to do is create simulation environment, and trying to see if I could display letter while program is running. Don't worry about how I can get VB running interconnect with program, I had a success in that area. All I
I wanted to know if its possible to retrieve data files from program and have it display in picbox or captionbox on the form? Allow me give a simple demostration as an example.

File saved as AWAY.DAT in data file--> from program

Code:
----------------------------------------------------------------------
00C 37.203178-107.869194 6683 ;Animas
00CA 35.350525-116.888367 3038 ;Goldstone (gts)
00CO 40.622204-104.344398 4829 ;Cass Field
00FA 28.645548 -82.218971 52 ;Grass Patch
----------------------------------------------------------------------


VB6 FORM MAIN
+------------------------------------------------+
| .____________ |
| |Animas | |
| |___________ | <--Picture/Caption box |
| .____________ |
| |Golstone(gts) | |
| |___________ | |
| .____________ |
| |Cass Field | |
| |___________ | |
| .____________ |
| |Grass Patch | |
| |___________ | |
| |
|___________________________________________|

It will not display anything unless program begain to initialize. Once it initialize, the datas coming directly folder along with program will display the letter context inside or on the picture/caption box.
If it's possible would there be any code examples? or some sources that may provid imformation similar to what I am looking for.

Let me know

Arthur

* RESOLVED * Need API To Retrieve Display Refresh Rates.
My app need these to be populated into a combo. Hard coding refresh rates isn't a good idea as all gfx cards/monitors differ.

I also need the resolutions if possible.

Much help appreciated.

How To Retrieve Data From Database And Display It In Labels?
I would like to know how i should go about doing the above.
I know it has something to do with lblHelp.caption.

But the problem for me now is i have two combo boxes to select two conditions and the data retrieved from my database to be displayed has to be based on what is selected in the combo boxes. Say the comboboxes Im using are cmbDepts and cmbEmployees and my label is called lblname can someone guide me? lblname.caption = ?????

Retrieve Record And Pass Parameter To The Other Form
Hello, My system is more on searching system, so the main process is about the searching, i try to pass the parameter to another form but cannot, here is my idea:


There are several types of searching method, by name, by service and by location, so when i want to search for an examples, by name "test" so when i click view, it will pass the word "test" to the other form and the process to search the word is in that form. i also got a problem with to retrieve the record, here my idea:


Code:
Private Sub cmdNameView_Click()

If txtName = "" Then
MsgBox "Please enter your query to search", vbCritical, "Error"
Exit Sub
End If

Set rs = conn.Execute("Select * from SUPPLIER where [sName] = '" & sName & "'")

if(recordfound) then
Label7.caption = result
if(recordnotfound) then
Label7.caption = No record found
End If

End Sub


the label7 is a test label for me to retrieve the data from the txtName text. i'm not familiar with the recordset function, i try to google it to find any reference, but most of it use the "next", "previous". button. can anyone guide me the IF expression and to bind the data to the Label7?

Thanks in advance

Retrieve Database Record By Button Press
Hi all,

I have an MSAccess database and was wondering how I can access a specific record by clicking a command button. I have a few buttons in a control array and depending on the index I'd like it to retrieve a corresponding record in a table.

I'm not sure whether ADO or DOA access methods are best. I'd appreciate your help.
I can't find any code examples of what I want.

Many thanks

Retrieve And Display Numerical Values From A Table On The Internet
As my title says i am having trouble to display numbers from a table on the internet i am just using Visual Basic

Note: i want to display them in text boxes

Retrieve Data From A Text File And Display In A Textbox.
Hi! I hope someone could help me with this.

I want to retrieve data saved in .pnp file and display it in the same txtboxes and same order as it was saved.

My current code is:


VB Code:
(globalvar.bas)Option Explicit Public pn1 As New partnamelist (frm_field)Private Sub fieldupload()    With pn1 'I made a class named partnamelist having these 4 properties: part, description, quantity, and version        .part = txt_part.text        .description = txt_desc.Text        .quantity = txt_qty.Text        .version = txt_version.Text    End WithEnd Sub Private Sub cmd_apply_Click()dim filename as string        If Len(txt_part.text) = 0 And _        Len(txt_desc.Text) = 0 And _       Len(txt_qty.Text) = 0 And _       Len(txt_version.Text) = 0 Then        MsgBox "please enter the necessary values."        txt_part.setfocus    Else        fieldupload        filename = txt_filename.text 'Specified filename of the user        MsgBox ("Creating profile...  Please choose what directory to save your profile.")        frm_dir.Show vbModal    End IfEnd Sub  '(frm_dir) Private Sub Form_Load()    txt_pnprofile.Text = frm_field.filename + ".pnp"     '--> "pnp" here in my example is my chosen extension.End Sub Private Sub cmd_ok_Click()    txt_profilepath.Text = file1.Path & file1.FileName & "" &  txt_plprofile.Text 'file1 is a file listbox btw        MsgBox "Saving " & txt_profilepath & " as new profile."        SaveProfile txt_profilepath.Text, pn1    profilepath = txt_profilepath.TextEnd Sub Private Sub SaveProfile(WhatFile As String, TheProfile As namelist)Dim FreeFileHandle  As Integer     FreeFileHandle = FreeFile    Open WhatFile For Output As FreeFileHandle    With TheProfile        Print #FreeFileHandle, "[Part] " & .part        Print #FreeFileHandle, "[Description] " & .description        Print #FreeFileHandle, "[Quantity] " & .quantity        Print #FreeFileHandle, "[Version] " & .version    End With    Close FreeFileHandleEnd Sub


Output of egfile.pnp:
[Description] b42
[MakerCode] c65
[PartnameCode] x32
[Quantity] x75
[SymbolicCode] q21

After clicking RETRIEVE button, I want that b42 will be displayed in txt_description.text and so on and so forth.

How do I do this? I don't know how to use Line Input # Statement as well.

Anybody, pls. help.

Time To Retrieve 10000 Rows And Display Them? What Is Acceptable?
OK, regardless of what technology you have used, or what type of design your app follows, how long would you expect it to take to retrieve 10,000 records and display them in some form of control?

Now I don't care about the number of fields etc. Just a rough time.
Everyone who has written a DB app must have tested it and thought "That's slow, oh if I do this then it speeds it up.".

If 10,000 records took me 185 seconds to retrieve and display then there is something wrong and my application need optomising.

So, roughly what is an acceptable time?

Woka

How To Retrieve Unicode Characters (e.g. Greek) From An AS400 Datasource, And Display Them
I think this might be an interesting tool, so I chose to share it.



Is life as bad as dreams?
I guess that's just the way it seems!

Retrieve Auto-number Primary Key Of Newly-added Record
This is a "newbie" question, which I've translated into the usual "customer and order" paradigm.

I have a Customers table and an Orders table. The primary key of the Customers table is an auto-number field ("CustomerID") which also appears as one of the fields of the Orders table. I have a user input form which gathers information about a new customer and a new order, and appends a record to both tables.

The question is, how do I capture the CustomerID value of the newly-added customer record, in order to put its value into the new order record? Here is some stripped-down code:

Code:
'Using DAO architecture
Dim MyDatabase As DAO.Database
Dim RS As DAO.Recordset

< Much code for various controls on this form, to assign..>
< variables representing Customer fields and Order fields >

Private Sub AddNewOrder() 'Adds both a customer and an order
Set MyDatabase = CurrentDb
'First, append a new customer record
Set RS = MyDatabase.OpenRecordset("tblCustomers")
With RS
.AddNew
![CustomerField1] = <varMyCustField1>
![CustomerField2] = <varMyCustField2>
< etc.>
.Update
.Close
End With
'Now append a new order record
Set RS = MyDatabase.OpenRecordset("tblOrders")
With RS
.AddNew
![OrdersField1] = <varMyOrderField1>
![OrdersField2] <varMyOrderField2>
< etc.>
![CustomerID] = < ??? >
.Update
.Close
End With
End Sub
OK, so my question is: What do I put in place of < ??? > in
the above code? Thanks in advance for any help.

--Andy

Display As One Record
Is it possible to insert a set of records into another table as one record using SQL? This is needed because I want to display the set of records in a data report in one line. Please help.

Thanks

Display The First Record
how to make the first record of the table named Prod_Cat and its field named "Cat_Code" to be display in the combo box while the form load?

Record Display
I develpoign application using VB and MS Access
I have written following code

Private Sub Command1_Click ----- to add record
Set rststud = New ADODB.recorset
rststud.open “tblstudents”,dbconn,adOpenkeyset,adLockOptimistic
with rststud
.addnew
!studentid=text1.text
!studentname=text2.text
!joindate=format(“text4.text”,dd/mm/yy)
!leavedate=format(“text4.text”,dd/mm/yy)
.Update
.Requery
.Close
End sub

Private Sub text6_lostfocus() ---- to display record
Set rststud = New ADODB.recorset

rststud.open “Select * from tblstudents where joindate= ‘” & text5.text & “’ and leavdate = ‘”&text6.text & ‘””,dbconn,adOpenkeyset,adLockoptimistic ------- getting error here...

If .Recordcount > 0 then
Set MSHflexgrid1.refresh
MSHflexgrid1.formatstring= “ StudentID | Student Name | Join Date | Leave Date | “
MSHflexgrid1.Datasource=rststud
End if
.Close
End sub

Private Sub Form1_Load ( )
Set dbconn=New ADODB.Connection
Dbconn.connectionstring= “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:student.mdb;Persist Security Info=False
Dbconn.open
Set MSHflexgrid1.refresh
MSHflexgrid1.formatstring= “ StudentID | Student Name | Join Date | Leave Date | “
End Sub

I wanted to display record using two dates..... i.e. from joindate and leavedate....

suppose consider following tablewith data: -

studentid studentname joindate leave date
101 abc 12/02/01 20/02/03
102 bc 12/03/00 20/01/02
103 kb 12/02/02 15/03/05

how to display record on date criterianbasis

suppose i enter date joindate 01/02/01 and leave date 15/01/02 it should diplsay records fall in this criterian.. how should i do

thanks

Display As One Record
Is it possible to insert a set of records into another table as one record using SQL? This is needed because I want to display the set of records in a data report in one line. Please help.

Thanks

Display Only One Record
hi..is there a way of only displaying one record in a data report instead of displaying every record that is in a table? thanks.

Display One Record
Can somebody tell me how I can show one record in Crystal Reports from vb6. I Go from form1 to a crystal report and there I want to show one record that I selected in form1. How can I give the variable through? So form1 gives the value 1 through to chrystal reports and chrystal reports display record nr. 1. Where do I put the variable, only in vb6 or also in Crystal Reports? And where?

Remco Ploeg
ploegr@promar-agencies.nl

Hierarchical Record Display
Hello folks,

I am trying to build a spreadsheat like GUI for a hierarchical recordset. The idea is to display a tree structure in a horizontal display. The is no set amount of nodes and no set amount of levels. Does anyone know of a good way of doing this. Maybe a control that already does this, or some combination of controls that would serve my purpose. I also need it to be functional (i.e. be able to click on any one item of information).

Thank you in advance

Best Control To Display A Record Set
Hi

I have a record set containing 2000+ rows each with four fields.

What is the best method (ie, control to use) to display the data for a user to scroll down through and eventually select one of them.

I have tried using a datagrid (VB6 SP5) but I get a blank grid.

Any help appreciated.

Paul

Code follows:

Private Sub Form_Initialize()

Dim objSelectStmt As New CSelectStmt
Dim objSelectResults As CSelectResults

Dim strSQL As String ' Hold SQL query
strSQL = "SELECT TP, KnownAsName, Description, Description2 FROM fdTradingPartne ORDER BY TP"

Set objSelectResults = objSelectStmt.Execute(strSQL)
If DisplayAndClearErrors(oSession) Then Exit Sub

' Create an instance of the Recordset.
Set rsTradingPartners = New ADODB.Recordset

With rsTradingPartners
.Fields.Append "TradingPartner", adVarChar, 40
.Fields.Append "KnownAsName", adVarChar, 40
.Fields.Append "Description1", adVarChar, 40
.Fields.Append "Description2", adVarChar, 40
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open ' No connection object needed.
End With

objSelectResults.MoveTo (0) ' Move to first record in result set
While Not objSelectResults.EOF ' Process result set

rsTradingPartners.AddNew

If IsNull(objSelectResults.Row(0)) Then
rsTradingPartners!TradingPartner = ""
Else
rsTradingPartners!TradingPartner = objSelectResults.Row(0)
End If

If IsNull(objSelectResults.Row(1)) Then
rsTradingPartners!KnownAsName = ""
Else
rsTradingPartners!KnownAsName = objSelectResults.Row(1)
End If

If IsNull(objSelectResults.Row(2)) Then
rsTradingPartners!Description1 = ""
Else
rsTradingPartners!Description1 = objSelectResults.Row(2)
End If

If IsNull(objSelectResults.Row(3)) Then
rsTradingPartners!Description2 = ""
Else
rsTradingPartners!Description2 = objSelectResults.Row(3)
End If

rsTradingPartners.Update

objSelectResults.MoveNext ' Process next result set row
Wend


Set gridTradingPartner.DataSource = rsTradingPartners ' Associate recordset with grid

gridTradingPartner.Row = 0 ' Ensure that the first in list is visible
gridTradingPartner.Refresh

end sub

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 Next Found Record
hi i was wondering if anyone could help i need to serach through my data base for a name but the problem is two or more people can have the same surname and i would like to display the first find then click a command button to display the next i have the following code at the moemt but it only displays the last record with this name found. Thanks for any help

Private Sub Command3_Click()
Data1.Recordset.OpenRecordset
Data1.Recordset.MoveFirst
Do Until Data1.Recordset.EOF
x = Data1.Recordset("Surname")
y = Data1.Recordset("Passcode")
If (UCase(Text1.Text) = x) Or (UCase(Text2.Text) = y) Then
found = True
Call updatevalues
End If
Data1.Recordset.MoveNext
Loop
If (found = False) Then
MsgBox ("not found")
Else
End If
End Sub

after it calls the update value sub the next bit of code ( that i need to change obviousley ) says:

msgbox (("search has found the following ") & (Data1.Recordset("Surname")) & (Data1.Recordset("Passcode")))

Display The Record On The Second Form
hi good day

NOTe: tables: Product_tbl(Product_ID as Numeric is the Primary Key), Supplier_tbl(having Product_ID as Numeric the Foreign Key).

The program requires that all Products are displayed in a form using datagrid (say form1) and when we double click a row a second form will popup displaying the supplier of the clicked product(say form2).


How can I display the list of supplier of that product on the second form using ADO? please help

by the way I'm using MS SQL SERVER 2000.

Limiting The Record To Display
I want to display a record from certain position up to the limit I specified...

In PHP/mySQL can do this by using this code

$limit=10
$start=20
Select * from table LIMIT $start,$limit

the above example will display 10 records from row 20. How to do this in visual basic?

Find And Display A Record
if i was to put a button on to search for a name and display the record, how would i do it.
is it something like
"SELECT * FROM table1 WHERE name = 'casey'"

i have this so far without the search button.

Code:
Option Explicit
Dim con As ADODB.Connection
Dim rec As ADODB.Recordset

Private Sub Form_Load()
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:databaseslah.mdb;"
con.Open

Set rec = New Recordset
rec.Open "SELECT name, phone FROM table1", con, adOpenKeyset, adLockOptimistic

Text1.Text = rec.Fields.Item("name")
Text2.Text = rec.Fields.Item("phone")

End Sub


Private Sub Command1_Click()'move forward
rec.MoveNext

If rec.EOF Then
MsgBox "End of file"
rec.MovePrevious
Else
Text1.Text = rec.Fields.Item("name")
Text2.Text = rec.Fields.Item("phone")
End If

End Sub

Private Sub Command2_Click()'move back

rec.MovePrevious

If rec.BOF Then
MsgBox "Start of file"
rec.MoveNext
Else
Text1.Text = rec.Fields.Item("name")
Text2.Text = rec.Fields.Item("phone")
End If

End Sub

thank you.
casey.

How To Display Last Record From Access
hi all...i have one more question..

I have one textfield to display last record of Invoice Number..
So when user want to add new invoice number..the textfield will show the last invoice number stored in database.

any helping is very much appreciated

thanks in advance

Multiple SQL Record Display
I have created a program that allows users to enter a sales order number, and obtain tracking info from a database... I am using SQL to perform this.... However, some sales order numbers have multiple boxes and/or shipments, and I am not sure how to first get ALL the records, and second display each record discretely....

Can anyone assist me?

Thanks in advance..........

Display Current Record??
I am using the ADO Data Control with access, i have a label where i want it to when the user goes from record 1 to record 2. Basically i wana be able to show the record that the user is on. Is there a way i can do it. I tried with alot of the commands but nothing seems to work

so something like this



You are on record [3] from [5]


Thx for you help.

Why Display Duplicate Record
I have this problem with Data Report. My problem is datareport show duplicate record despite i have specified a range of number from txtpoli1.text to txtpoli2.text

For Example, if i specified 001 to 004. DataReport Show 4 duplicate of 001 . Instead of Displaying 001,002,003,004



VB Code:
Set adoRecordset = New ADODB.RecordsetSQL = "SELECT * FROM tb_master WHERE policyno BETWEEN '" & Txtpoli1.Text & "'  And '" & Txtpoli2.Text & "' "adoRecordset.Open SQL, adoConnection, adOpenStatic, adLockOptimistic, adCmdtextadoRecordset.RequerySet PremiumNote.DataSource = adoRecordsetIf adoRecordset.RecordCount > 0 Then    Response = MsgBox(adoRecordset.RecordCount & " " & "record selected.Do you want to print?", vbYesNo + vbQuestion, "Record Found")    If Response = vbYes Then        Call PremiumReport '  This is where i specific Record and  show Report     End IfElseMsgBox "No Record Found Between these days", vbExclamation, "Date"End If Set adoRecordset = Nothing


i have tried to change the curcor type to adOpenDynamic but when i changed to adOpenDynamic RecordCount Show -1.

Then If i change the curcor type to adCmdTable it give me an ERROR. [Microsoft][ODBC Microsoft Access Driver] sytnax error in FROM clause.

If i use back adOpenStatic and adCmdText, it works but Record duplicate as i mentioned above

Please help. Thank you in at advance

Record Number Display In VBA
i would like to thank those people who helped me to overcome my PREVIOUS problem

my new problem is that i would like to display the number of records in a given table in a text box on a form which is bound to that table. i am working in VBA Access- so any help please?

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

Large Record To Display
hi,
i have created an application to display data on the grid. for some
reason the only way to populate a grid unbouned is via an array, traversing
it row by row column by column. is there another way of making this process
faster? i'm using hierarchical flex grid by the way.

thanks,

Anthony M. Sagalongos
Wilco International (Australia) Pty Limited
Suite 2, Level 18, 201 Kent Street, Sydney, NSW 2000
EMail : email@removed
Phone : (Direct): +61 2 8259 9058
Phone : (Switch): +61 2 8259 9000
Fax : +61 2 8259 9001



This message is confidential and may also be legally privileged. If you are not the intended recipient, please notify email@removed immediately. You should not copy it or use it for any purpose, nor disclose its contents to any other person. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of Wilco.

How To Display Record In DBGrid
Hi Friends,

I have ADODC control, DBGrid1 Control and following SQL statemnt.
SQL = Select custid, name, address from Customer

I am unable to display in my result in DBGrid1.

Can you guide or provide sample how to bind the and display result in dbgrid.

What setup do i need to use in ADODC1 and DBGrid1 to display record.

Best Regards
SM

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...

How To Display Record In Combobox If There Is...
Hi everyone

I have one table in sql server. there is null values in fields of this table. When i try to display records in combobox. it doesnt display anything.

using this code

Code:while not rst.eof
        combo1.additem rst!cust_name
        rst.movenext
wend

rst.close
set rst =nothing

it is not working. Also i am trying to display records in text box then it is displaying that invalid use of null.

So please help me out

Thanx in advance




Edited by - Pyash on 12/19/2004 9:01:35 PM

Record Display Problems
I am having some problems getting data to display in my text boxes.

Here is the connection code:

Code:

    With adoSupportInfo
      .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Persist Security Info=False;Data Source=" & strPath & _
      "; Mode=Read/Write"
      
      .CursorLocation = adUseClient
      .CursorType = adOpenStatic
      .CommandType = adCmdText
      .RecordSource = "SELECT * FROM GetSupportInformation"
      .Refresh
   End With



Here is the population of the text boxes:

Code:

    txtStaffLastName.Text = adoSupportInfo.Recordset("LastName")
    txtStaffFirstName.Text = adoSupportInfo.Recordset("FirstName")
    txtStaffHomePhone.Text = adoSupportInfo.Recordset("HomePhone")
    txtStaffWorkPhone.Text = adoSupportInfo.Recordset("WorkPhone")
    txtStaffCellPhone.Text = adoSupportInfo.Recordset("CellPhone")
    txtStaffPagerPhone.Text = adoSupportInfo.Recordset("PagerPhone")
    selStaffGroup.Text = adoSupportInfo.Recordset("GroupName")
    selStaffLocation.Text = adoSupportInfo.Recordset("Location")



Here is the recordset navigation code:

Code:

Private Sub cmdEditFirst_Click()
    
    adoSupportInfo.Recordset.MoveFirst
    
End Sub

Private Sub cmdEditLast_Click()
    
    adoSupportInfo.Recordset.MoveLast
    
End Sub

Private Sub cmdEditNext_Click()

    If adoSupportInfo.Recordset.EOF Then
        MsgBox "You have reached the last record!", vbInformation, "Record Navigation"
    Else
       adoSupportInfo.Recordset.MoveNext
       txtStaffLastName.Refresh
    End If
    
End Sub

Private Sub cmdEditPrevious_Click()

    If adoSupportInfo.Recordset.BOF Then
        MsgBox "You have reached the first record!", vbInformation, "Record Navigation"
    Else
        adoSupportInfo.Recordset.MovePrevious
    End If
    
End Sub




When clicking on the navigation buttons it does appear to be moving through
the records but the text boxes are not updating. I was thinking I had to do
some kind of refresh on the text boxes but was not sure how to do that or if
my thinking is all wrong here.

Thanks,
Tim

How To Display A Particular Record In A Adodc
I have a two form application. The first displays all tasks, the second displays (or should) a single task, along with all of the details of audit history for that task.

Using the form wizard, I have the second form displaying 'a' task and the details of that task.

My problem, is how do I get the second form to display a particular task (say TASKID = 5), And how to get this form to change and display a different task when directed to from either the controls or from a public method call?

----

Display Record Without Grid
HI,
i want to show one by one record from begning of record to end of record.
How to do this??

Actually i want to display first record from database when i load the form,then if i make changes to any field in that form and click movenext then it should update it and move to next record.How to do this???

Like without any condition it should show all records and allow me to change and then it should move to next record.

iam fetching data from different table and placing it in the corresponding textbox of the form.

i tried by using while loop but it is not working

please helpme out

Thank u
sowmya s

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