Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 23rd, 2003, 08:51 PM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
method of going back to the front records?

Hello!

I am using visual basic 6 and MSAccess 2000...

I am askin about whether there is a method or functions that allow the recordsetpointer to point to the first field of the recordset...?

Thanks for reading my message.

Ham

Reply With Quote
  #2  
Old September 23rd, 2003, 10:51 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
how about showing some code as to how you are interacting with the recordset...

if you are using an adodb recordset you can use the movefirst method.

Reply With Quote
  #3  
Old September 23rd, 2003, 10:58 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,715 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 21 m 37 sec
Reputation Power: 688

Reply With Quote
  #4  
Old September 25th, 2003, 02:11 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
U can do:
dim rs as recordset
rs.movefirst
....

Reply With Quote
  #5  
Old September 25th, 2003, 02:26 AM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My Code goes like tt:
Code:
Option Explicit
Dim n, m, i, inc, t1Inc, t2Inc As Integer
Dim WithEvents cnn As ADODB.Connection
Dim WithEvents rst As ADODB.Recordset

Private Sub Form_Load()
  Dim cnnstr As String
    Set cnn = New ADODB.Connection
    Set rst = New ADODB.Recordset
    cnnstr = "Select * from Node"
    With cnn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .ConnectionString = "Data Source=C:\My Documents\My Project\bearer.mdb"
        .Open
    End With

    With rst
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        .LockType = adLockOptimistic
        .Open cnnstr, cnn
    End With
End Sub

Private Sub cmdFind_Click() 'Find Button
Dim sFind As String
Dim f As ADODB.Field
Dim counter, posRec As Integer
inc = -500
t1Inc = -500
t2Inc = -500
If txtBID.Text = "" Then
    MsgBox "Please Enter the correct bearer Id", vbInformation, "Error"
    txtBID.SetFocus
    Exit Sub
End If

sFind = Trim(txtBID.Text)
rst.Find "Bearer_ID LIKE " & "'" & sFind & "*'"
posRec = rst.AbsolutePosition
If (posRec > adPosBOF) Then
    If (Not posRec = rst.BOF Or rst.EOF) Then
    'if the fields are not null
        For Each f In rst.Fields
            If IsNull(f.Value) Then '<!-- how can set the number of fields to come out 
                Call LoadImg
                Call LoadText1
                Call LoadText2
             End If
        Next
        'If picturebox is too small, increase the width and make scrollbar visible
        If imgbox(imgbox.UBound).Left > picInner.ScaleWidth Then
            picInner.Width = imgbox(imgbox.UBound).Left + 2000
            HBar.Visible = True
        End If
        
    End If
    Else
        MsgBox "No records Found", vbCritical, "No records"
End If
    rst.MoveFirst
    loadRecord ' to load the records into textboxes

End Sub

Public Sub loadRecord()
    Text1(1).Text = rst.Fields("Node1").Value
    Text2(1).Text = rst.Fields("Node2").Value
    Text1(2).Text = rst.Fields("Node3").Value
    Text2(2).Text = rst.Fields("Node4").Value
    Text1(3).Text = rst.Fields("Node5").Value
End Sub

Private Sub LoadImg()
    Load imgbox(imgbox.UBound + 1) 'Load imgbox() array
        inc = inc + 2000
        With imgbox(imgbox.UBound) ' imgbox property
            .Picture = LoadPicture(App.Path & "\circle.gif")
            .Left = inc
            .Top = 2000
            .Width = 700
            .Height = 700
            .Visible = True
            
        End With
End Sub

Private Sub LoadText1()
    Load Text1(Text1.UBound + 1)    'load upper textboxes
        t1Inc = t1Inc + 2000
        With Text1(Text1.UBound)    'Textboxes properties
            .Left = t1Inc
            .Top = 650
            .Width = 800
            .Height = 500
            .Visible = True
        End With
End Sub

Private Sub LoadText2()
    Load Text2(Text2.UBound + 1)    'load lower textboxes
        t2Inc = t2Inc + 2000
        With Text2(Text2.UBound)    'Textboxes properties
            .Left = t2Inc
            .Top = 3200
            .Width = 800
            .Height = 500
            .Visible = True
        End With
End Sub

*edit* placed code tags around content

Last edited by Onslaught : September 25th, 2003 at 08:21 AM.

Reply With Quote
  #6  
Old September 25th, 2003, 08:24 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Ok, I'm not really sure what your asking.
By re-reading your first post, I believe I have misunderstood what you are wanting as as recordset pointer points to a row and not to a field.

Can you please explain what you want to accomplish.

Reply With Quote
  #7  
Old September 25th, 2003, 08:39 PM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Onslaught for reading my reply.

I wan the recordset pointer to point to the fields in a row instead of row by row...

So tt i can set where the pointer of which fields i wan to start retrieving data from?

Thanks.

Reply With Quote
  #8  
Old September 25th, 2003, 09:48 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Sorry, don't really know of such a method of function to accomplish this. It would have to be something custom.

Reply With Quote
  #9  
Old September 25th, 2003, 11:16 PM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Thanks Onslaught...

Thanks for replying to my post...
I really appreciated ur help.

Thanks... if i happen to find out how to do, i will msg U to tell U how it is done...

Thanks...

Reply With Quote
  #10  
Old September 25th, 2003, 11:17 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
I don't know too..

Reply With Quote
  #11  
Old September 26th, 2003, 07:42 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
just as an idea, you could use a counter to keep track of where you are in the fields and if you haven't gotten to the field you wish to start with then continue in the loop.
i.e.
Code:
Private Sub foo(rs as ADODB.Recordset, st  as Integer)
    Dim cntr as Integer

    cntr = 0
    For Each f in rs.Fields
        cntr = cntr + 1
        If (cntr < st) Then Next
        'do what you wanted with the field
    Next
End Sub

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > method of going back to the front records?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |