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





See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Move Ado.recordset To The Right Record
hi,

i'm working with an adodc (navigator) against DB Access.
in addition, i can search for a specific row on the same table, but then if trying to continue navigating with the adodc, error occurs saying:

' the changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relationship. cahnge the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.'

thanks

Move To Middle Record In Recordset?
I want to be able to select the middle record from a record set and so thought that I could simply declare a variable based on rs.RecordCount:

intMiddleRecord = rs.RecordCount / 2

how do I now move to intMiddleRecord??

.Move(intMiddleRecord)??

How To Move Record Pointer Inside Selected Recordset
how will i know the record pointer of this statement:

Dim conn As New ADODB.Connection
Dim recset As New ADODB.Recordset
Set recset = New ADODB.Recordset
Frame1.Enabled = False
Frame2.Enabled = False
conn.open Connectstrings
recset.CursorLocation = adUseClient
recset.CursorType = adOpenDynamic
recset.LockType = adLockOptimistic

recset.Open "SELECT * FROM emp_tbl order by lname asc", conn
recset1.Open "SELECT * FROM emp_tbl where lname ='"& lnametxt.text &'"", conn

recset.moveprevious where recset1!lname=recset!lname

my lnametxt.text should be my record pointer in such a way i could movenext, moveprevious, movelast, movefirst other records.

Move Directly To Record In Recordset Where PrimaryKey=text Entered In Txtbox. How?
Does an ADODB recordset have any method to move directly to a record specified by the value of the primary key.

A recordset has already been opened returning all records in the Task table.

I have a search textbox where a user can enter a value...

Then What I want is a button which when pressed will do:
-Check value entered in the search textbox for a matching value in the table (the value the user enters will be for example TASK055).

-If value is found, move to and display the record in the recordset that matches the value (there will only be one match as the value is the primary key).


It is mainly the second part (moving to and displaying the record) that I am unsure of.
As the recordset is already open, and the user can browse backwards and forwards, is there any quick method of just shooting the user to that record by matching the value they typed?

Can anyone please help?

Move Directly To Record In Recordset Where PrimaryKey=text Entered In Txtbox. How?
Does an ADODB recordset have any method to move directly to a record specified by the value of the primary key.

A recordset has already been opened returning all records in the Task table.

I have a search textbox where a user can enter a value...

Then What I want is a button which when pressed will do:
-Check value entered in the search textbox for a matching value in the table (the value the user enters will be for example TASK055).

-If value is found, move to and display the record in the recordset that matches the value (there will only be one match as the value is the primary key).


It is mainly the second part (moving to and displaying the record) that I am unsure of.
As the recordset is already open, and the user can browse backwards and forwards, is there any quick method of just shooting the user to that record by matching the value they typed?

Can anyone please help?

UPDATE Record As Last Record In Recordset... Updating A Recordset Generally?
As the title of the message suggests, I have an UPDATE statement which Updates a record in a table.

Firstly the AddNew adds a new record, and reserves it a space by Inserting the Primary Key into a new record the table (In this way the recordspace is reserved and that primary key preserved). If the user should cancel, that record is deleted. Both are working fine...

If the user does not cancel, but instead presses Update, the remaining fields are Updated into that appropriate record in the table, this is also fine...

The problem then arises, after adding 1 record...

If the user either tries to browse back or forwards, it will not move at all.

so the only way to even (half) get around this is...

If the user then clicks AddNew again, and then Cancel again,
they can now browse through records again, but the previous record that was inserted appears to have gone missing...

But, oh no it hasnt, it has inserted itself at the beginning of the recordset

Why?


Because of this, it either makes me believe...

(a) the Recordset adoPrimaryRS is not being updated properly
or
(b) there is a problem with the AddNew button (although I could be wrong)

After using the INSERT INTO, I have tried each of the following:
.Requery
.Resync
.Update
.Save

None have worked, they keep complaining about creating duplicate records


The code for my cmdUpdate button is as follows:

Code:
cmdUpdate_Click()

Dim InsertTaskRecord As String

InsertTaskRecord = "UPDATE Task SET TaskName='" & txtTaskName & "', TaskPriority='" & txtTaskPriority & "', TaskDate='" & txtTaskName & "' WHERE Task.TaskID='" & txtTaskID & "'"

db.Execute InsertAdminRecord

End Sub

and the code for my AddNew button is as follows:

Code:
cmdAddNew_Click()

Dim InsertNewTask

InsertNewTask = "INSERT INTO Task(TaskID) VALUES('" & txtTaskID & "')"

db.Execute InsertNewTask

Can anyone see the solution to this problem or what could be wrong with what I have done ?

UPDATE Record As Last Record In Recordset... Updating A Recordset Generally?
As the title of the message suggests, I have an UPDATE statement which Updates a record in a table.

Firstly the AddNew adds a new record, and reserves it a space by Inserting the Primary Key into a new record the table (In this way the recordspace is reserved and that primary key preserved). If the user should cancel, that record is deleted. Both are working fine...

If the user does not cancel, but instead presses Update, the remaining fields are Updated into that appropriate record in the table, this is also fine...

The problem then arises, after adding 1 record...

If the user either tries to browse back or forwards, it will not move at all.

so the only way to even (half) get around this is...

If the user then clicks AddNew again, and then Cancel again,
they can now browse through records again, but the previous record that was inserted appears to have gone missing...

But, oh no it hasnt, it has inserted itself at the beginning of the recordset

Why?


Because of this, it either makes me believe...

(a) the Recordset adoPrimaryRS is not being updated properly
or
(b) there is a problem with the AddNew button (although I could be wrong)

After using the INSERT INTO, I have tried each of the following:
.Requery
.Resync
.Update
.Save

None have worked, they keep complaining about creating duplicate records


The code for my cmdUpdate button is as follows:
Code:
cmdUpdate_Click()

Dim InsertTaskRecord As String

InsertTaskRecord = "UPDATE Task SET TaskName='" & txtTaskName & "', TaskPriority='" & txtTaskPriority & "', TaskDate='" & txtTaskName & "' WHERE Task.TaskID='" & txtTaskID & "'"

db.Execute InsertAdminRecord

End Sub



and the code for my AddNew button is as follows:
Code:
cmdAddNew_Click()

Dim InsertNewTask

InsertNewTask = "INSERT INTO Task(TaskID) VALUES('" & txtTaskID & "')"

db.Execute InsertNewTask



Can anyone see the solution to this problem or what could be wrong with what I have done ?

Searching For Record In DB Doesn't Move To Found Record!! GOING INSANE!!!
I have been working on this for days, and cannot for the life of me find a solution.

I am trying to search for an entry in "TempTable" table based on the value from a record in "Seat" table. If it doesn't exist, then it copies the entry from "Seat" to "TempTable" However, if it is found, then all I need to do is edit the found result in "TempTable"

Nothing that I have used (seek method, findfirst methods, find method, with any combination of connections types) will work. The record may be found (I'm not sure), but the recordset position doesn't move to the result. I would use SQL, but when I do SELECT, it ignores all plank records, and I need to use all the records to keep track of where I am in the database. The "Seat" table has 703 records, some blank, and some not. I would like to be use .absoluteposition to figure out which record that I am at, but if nothing moves, I can't keep track of where I am in the Database. It is imparative that .absolutepostiion use all the records.

Please take a look. Suggestions are GREATLY appreciated. I am going INSANE working on this!!!

Code:
Dim NewTable As TableDef

Dim dbSrc As Database

Dim rsSrcRes As Recordset
Dim rsSrcPrc As Recordset
Dim rsDesTmp As Recordset

Set dbSrc = OpenDatabase(DefaultLocation + "Database" + ActiveFile_Event)
Set rsSrcRes = dbSrc.OpenRecordset("Seat", dbOpenSnapshot)
Set rsDesTmp = dbSrc.OpenRecordset("TempTable", dbOpenDynaset)
  
rsSrcRes.MoveFirst
 
Do Until rsSrcRes.EOF
   If rsSrcRes.Fields("Reserved").Value <> "" Then
       
        rsDesTmp.Seek "=", rsSrcRes.Fields("Reserved").Value 'Doesn't work
        rsDesTmp.FindFirst "Name = '" & rsSrcRes.Fields("Reserved").Value & "'" 'Doesn't work either
        checker2 = rsDesTmp.AbsolutePosition 'Aboslute Position never changes, so the found record is never moved to
        
        If rsDesTmp.EOF Then 'add new entry to temp table
             'code for adding new record with rsSrcRes.Fields("Reserved).value
        End If
    
        ' code for editing the fields in the search result in "TempTable"
            
   End If
   rsSrcRes.MoveNext
Loop




Edited by - austio on 2/1/2006 7:18:51 AM

Read Line By Line Of Text File And Move Content To Excel Record By Record
Hi,
   i am trying to move the selective information in the text file to Excel sheet record by record using VB.Can u help me in this regard.

The contents in text file is like:

"http://www.commerx.com/contact.html","inforequest@commerx.com"
"http://www.commerx.com/contact.html","ClientSupport@commerx.com"
"http://www.commerx.com/services-intranets.html","intranets@commerx.com"
"http://www.davacosourcing.com/company/","bignews@davacosourcing.com"
"http://www.davacosourcing.com/company/","careers@davacosourcing.com"
.
.
.
.
.
.

The above information need to be moved in Excel sheet record by record as:                    
http://www.commerx.com/contact.html        inforequest@commerx.com    
http://www.commerx.com/contact.html        ClientSupport@commerx.com    
http://www.commerx.com/services-intranets.html    intranets@commerx.com    
http://www.davacosourcing.com/company/ bignews@davacosourcing.com
http://www.davacosourcing.com/company/ careers@davacosourcing.com
.
.
.
.
..

Please do help in this regard as there are more than 1000 information that has to moved in the above pattern.

Thanx
babu


 

Move A Row From "Recordset" Into A "Record"
Hi,

I have a situation like this. I select everything from a table in Access and then need to go row by row and process data fields. I would like to pass every row from the curent recordset to an processing function as a Record:

Dim AdoRS as Recordest
Dim AdoR as Record

Is there any way possible to do this

------------------
ID DATA
------------------
001 QWERTZYY
002 QWERETRE
003 AXFDSERR -----CopyTo-----> AdoR
004 ASWWWRR

etc.

Thanks, I hope that someone at least understands the question )

Using ADODB.Record To Pull A Single Record From A Recordset
I am attempting to pull a single record from a recordset to pass to a function for populating a chart. What is the best method to do this. I am having a problem opening the record from the recordset.

 Dim rsChartData As ADODB.Recordset
 Dim rData As ADODB.Record

... Get the recordset from a storedprocedure via a command object

Set rData = New ADODB.Record
Set rData.Source = rsChartData
rData.Open rsChartData

 I am getting an error "Object or provider is not capable of performing requested operation."

If anyone can help with this it would be appreciated. Also, if there is a better way to pass the record, other than each individual field as a variable, please plass that on.

Thanks

Search For A Record Using SQL And Then Put The Recordset's Pointer To This Record
Hello !
I have a database with one open recordset.
For example an Sql Query for "Users".

Now i do a search using a second recordset and get the primary
key for a specific user.

What i want to do , is to move the pointer of the
first recordset to the User record we found in the second recordset.
I know the primary key of the record found in the second recordset.

The first recordset is not just a simple table but an SQL Query that
includes the primary key.

i do not want to do a while loop since it may get slow

Thanks !

How To Record The Current Record Number In A Recordset??
glbRecSet.MoveFirst
Do While Not glbRecSet.EOF
  MsgBox "Account Number = " & glbRecSet("AccountNumber"), vbOKOnly, "Search Results"
  glbRecSet.MoveNext
Loop

This works fine, but what I want to do is have the it also tell me that this is, for example, record 1 of a total of 5 records in the recordset.  I know how to use ".RecordCount" to return the total number of records, but how do I return the number of the current record in the recordset?

Thank you
Kevin

Copy 1 Record From A Recordset To A Temporary Recordset?
I have a number of reports that run against various ADO recordsets and print out as form letters.  I need to export these reports on a letter-by-letter basis as individual PDF files.

When I only had one report running against a recordset built from a single table I set up an empty duplicate of the table as something I could bind a one-record recordset to.  I then copied one record, field by field, into this recordset and ran my report against that to get my single-letter report export file, cleared the one-record recordset, copied the next record and so on.

Now I have 10 reports and some of the recordsets are built from selected fields from 2 or 3 linked tables and the above method just won't fly.

Is there a way to create an unbound recordset in code, and any way other than field by field to get a single record from the result recordset of a query into it?

I'm working in VB6, currently using an ADO connection to an Access database but the database may be moved to SQL in the not-to-distant future.

Thanks in advance for any ideas...

How To Move To The Next Record?
I've got a table "Proj" with fields "tekst", "id".
Field "tekst" stores sentences. My aim is to break this string into separate words and store each word in a separate row in a new table "wywiad".

Problem is that my program does it but only for the first row of data and then it stops.
The second problem is that it asks me if I want to add a new row every time it adds a row.

Here is the code:

Sub breaker()

Dim string1 As String
Dim string2 As String
Dim position As Integer
Dim position_end As Integer
Dim id_num As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim strSQL As String
Dim strSQL2 As String

koniec = False
position_end = 1

Set db = CurrentDb

strSQL = "SELECT tekst as rsTekst FROM proj"
Set rs = db.OpenRecordset(strSQL)

strSQL2 = "SELECT id as rsID FROM proj"
Set rs2 = db.OpenRecordset(strSQL2)

string1 = rs("rsTekst")
id_num = rs2("rsID")

rs.Close
db.Close

x = InStr(string1, " ")
string_pocz = Mid(string1, 1, x - 1)
SQL = "INSERT INTO wywiad (id, slowo) values ('" & id_num & "', '" & string_pocz & "')"
DoCmd.RunSQL SQL

Do While InStr(string1, " ") > 0 And Not koniec
position = InStr(position_end, string1, " ")
position_end = InStr((position + 1), string1, " ")
If position_end < 1 Then
string2 = Mid(string1, position + 1)
koniec = True
Else
string2 = Mid(string1, position + 1, (position_end - position - 1))
End If
SQL = "INSERT INTO wywiad (id, slowo) values ('" & id_num & "', '" & string2 & "')"
DoCmd.RunSQL SQL

Loop

End Sub

--
Regards

Parad

Move To Next Record
I'm trying to get this to work I've got a combo box with text in it and a command button to move to the next record but it's not working right here's what it is doing if I select Apt 150 from the combo box type in a name in a text box for that Apartment then click on my add name buttonto add it to that apartment then click on the command button to move to the next record so I can enter another name for the same apartment it moves to the next item I have in the combo box which is another apartment. I don't want that is there a way to have it stay on the selected apartment so I can add other names to that apartment. also when I click on the add button it clears the combo box of the selected apartment so I have to select it again which is not what I want either.

Move To A Certain Record?
I am using ADO to populate controls (unbound) and I want to know how to navigate to a certain record with a Find Form.

So for example - if I find that an ID of 7 exists in the recordset - how would I then move to that record and have it reflect on the screen?

ASP Help(I Am NOT ABLE TO MOVE TO NEXT RECORD)
Hi,



i am having problem with movenext i am able to move to 2nd record but i
am not able to move forward from 2nd record code is here,please help me.



<!-- BeginMoveFirstVBS -->
<%@ Language=VBScript %>
<%' use this meta tag instead of adovbs.inc%>
<!--METADATA TYPE="typelib" uuid="00000205-0000-0010-8000-00AA006D2EA4" -->
<HTML>
<HEAD>
<TITLE>ADO MoveNext, MovePrevious, MoveLast, MoveFirst Methods</TITLE>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub cmdDown_OnClick
'Set Values in Form Input Boxes and Submit Form
Document.form.MoveAction.Value = "MovePrev"
Document.Form.Submit
End Sub

Sub cmdUp_OnClick
Document.form.MoveAction.Value = "MoveNext"
Document.Form.Submit

End Sub

Sub cmdFirst_OnClick
Document.form.MoveAction.Value = "MoveFirst"
Document.Form.Submit
End Sub

Sub cmdLast_OnClick
Document.form.MoveAction.Value = "MoveLast"
Document.Form.Submit
End Sub
//-->
</SCRIPT>
</HEAD>

<body bgcolor="white">

<% ' to integrate/test this code replace the
' Data Source value in the Connection string%>
<%

set myConnection = Server.CreateObject("ADODB.Connection")

myconnection.open "Provider=SQLOLEDB;" _
& "Data Source=labservices01labservices01A;" _
& "Initial Catalog=TN;" _
& "User ID=TNDAFQTP;Password=TNDAFQTP2002;"



Set rs = Server.CreateObject("ADODB.Recordset")

SQLQuery="select * from test"

rs.ActiveConnection = myconnection
rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Source = SQLQuery
rs.Open SQLQuery,myconnection



rs.MoveFirst

If Not IsEmpty(Request.Form("MoveAction")) Then
strAction = Request.Form("MoveAction")
varPosition = Request.Form("Position")



Select Case strAction

Case "MoveNext"

rs.MoveNext
If rs.EOF Then
rs.MoveLast

strMessage = "Can't move beyond the last record."
End If

Case "MovePrev"

rs.MovePrevious
If rs.BOF Then
rs.MoveFirst

strMessage = "Can't move beyond the first record."
End If

Case "MoveLast"

rs.MoveLast

Case "MoveFirst"

rs.MoveFirst

End Select
End If

%>

<!-- Display Current Record Number and Recordset Size -->
<h2>Record Number <%=rs.AbsolutePosition%> of <%=rs.RecordCount%></H2>
<hr>
<table cellpadding=5 border=0>
<!-- BEGIN column header row for Customer Table-->
<tr>
<th>Sample Number</th>
<th>Product Code</th>
</tr>

<!--Display ADO Data from Customer Table-->
<tr>
<td><%= rs("sampno") & ", " %>
<%= rs("prodcode") & " " %></td>
<td><%= rs("grade")%></td>
</tr>
<tr>
<td colspan=2><%=strMessage%></td>
</tr>
</table>



<form Name="Form" Method="Post" Action="MoveFirstVbs.asp">
<Input Type=Button Name=cmdDown Value="<">
<Input Type=Button Name=cmdUp Value=">">
<BR>
<H3>Click Direction Arrows to Use MovePrevious or MoveNext</H3>
<Input Type=Button Name=cmdFirst Value="First Record">
<Input Type=Button Name=cmdLast Value="Last Record">



<!-- Use Hidden Form Fields to record values to send to Server -->

<input Type="Hidden" Size="4" Name="MoveAction" Value="Move">
<input Type="Hidden" Size="4" Name="Position" Value="<%=
rs.AbsolutePosition%>">
</form>

<HR>
</BODY>

<%



If rs.State = adStateOpen then
rs.Close
End If

If myconnection.State = adStateOpen then
myconnection.Close
End If



%>
</HTML>
<!-- EndMoveFirstVBS -->

Move To Selected Record
I've put a listbox called 'lstUsers' on my User records form and I want to move to the selected LoginName's record. I'm using the .Move method from the recordset but that doesn't seem to work correctly...
My code

Code:
Private Sub lstUsers_Click()

'Display selected user record
Dim record As Integer
For record = 0 To lstUsers.ListCount - 1
If lstUsers.Selected(record) Then
UserRecords.Move record '<--------This is not working out
Call LoadFields 'Load all text boxes etc with data from record
Call DisableAdmin 'Disable admin record to prevent modifications
Exit Sub
End If
Next record

End Sub
The first time I select something, it moves to that record as expected, however, if I continue to select the login names nothing happens and I eventually get the "EOF or BOF is true..." error.
I could figure the difference between the rs.absoluteposition and selected listbox index and then either MoveNext or MovePrevious the abs(difference) number of times in a for...loop, but I'm certain there is a more effective way.

Lookup And Move Of A Record
Hey!

I need help with a project I am working on. I need to lookup a record in a access database.

Basically, I have created a form with a textbox and a button. What I want to happen is you enter in your ID and it will look up a record in a table called Whoishere and move the record to a table called History.

Any help would be great!!

Richard

How To Move A Database Record ?
I need to move records from table-1 in database-1 to table-2 in database-2, which table-1 and table-2 have same structure, they are Access database using ODBC as connector.

I want to know is there any quick method instead of moving data field by field ?



Code:
Dim CN As ADODB.Connection
Dim RS As ADODB.Recordset

Set CN = New ADODB.Connection
Set RS = New ADODB.Recordset

CN.Open "database-1"
RS.Open "select * from table-1", CN, adOpenForwardOnly

Do Until RS.EOF

If Mid(RS!note, 1, 5) < strDNOTE Then

strTotalRecMoved = 1 + strTotalRecMoved
End If

RS.MoveNext

Loop

RS.Close
CN.Close

Set RS = Nothing
Set CN = Nothing


Thank you in advance .....

How To Move 1 Record To Another Database?
Im useing dataenviroments connected to an Access Database. I wish to select a record in that database and move it to a compleatly new Access Database.

somthing like this...


VB Code:
deDataEnviroment1.rscomRecovery.Open "SELECT * FROM Recovery WHERE UniqueID =" & SelectedJob deDataEnviroment1.rscomRecovery.Move (deDataeviroment2.rscomInvoice History)


I know this wont work but this is what im tryign to achive, i wish to select and take out a record form one access database and place it in another. Both databases have identicle field layouts.

Many thanks in advance.

Move To A Record On A Form
I want to have a text box and button allow a form to
move to a specfic record
that the form's other text boxes are bound to VIA an ADODC
for the purpose of inquiry on information.

I have done this for years in Access VBA with the following:
dim r as recordset
set r = ME.recordsetClone
r,findfrist "[field] = " & value
me.bookmark = r.bookmark

but this is dao and I want to use
ADODC so I can initially connect to an access data base
but later connect to a SQL-server.

But I have not found VB6 code to replace the above VBA code.

Any help would be greatly appreciated
undefined

Record Set Move Commands
Hi

When using the following syntax to move to the previous record in a record get

'operation is not allowed in this context'

rsscanner.moveprevious

Any Ideas why as the

rsscanners.movenext

Works fine

Move Previous And Record????
I have an access database, which I connect to using ado code.

I have text boxes which displays info from the fields in the database.

I have created a "Next", and "Previous" button, which the user can move between the database info.

BUT my Previous button is not working.

Here is the code for it


VB Code:
Private Sub Command3_Click()  If Record.BOF = True ThenMsgBox "This is the First record found!", vbInformationExit Sub Else Record.MovePrevious  ' I GET AN ERROR IF I AM ON THE FIRST RECORD, I THOUGHT I PREVENTED THIS ABOVE' if i am not on the first record, I get an error "The operation is not allows in this context" WebBrowser1.Navigate (Record.Fields("IMAGEPATH"))txtDateOfScan.Text = (Record.Fields("DATEOFSCAN"))txtTimeOfScan.Text = (Record.Fields("TIMEOFSCAN"))txtProduct.Text = (Record.Fields("PRODUCTNAME"))txtWeight.Text = (Record.Fields("WEIGHTOFPRODUCT"))txtPrice.Text = (Record.Fields("PRICEOFPRODUCT"))txtBarcode.Text = (Record.Fields("BARCODE"))txtUsername.Text = (Record.Fields("PERSONWHOSCANNED"))   End IfEnd Sub


I get an "either BOF or EOF is true" etc etc error.

ALSO, when I msgbox record.recordcount , I get -1 in the mesagebox. Even though there are records present. (I can go through them with the next button)


Hope someone can help me with this

Unable To Move To The Next Record
I have a subform the recordsource for the form is returned from a stored procedure. The # of records are returned but
I am having trouble using next button to move to the next record in the subform. The error message occurred here
Set rstclone = Me.RecordsetClone
The error message is
MS VB:
Run_time error ‘429’:
ActiveX component can’t create object



Private Sub cmdNext_Click()
Dim up_bag_num As String, mk As String
Dim w As Integer, frm As Form
Dim rst As New ADODB.Recordset, rstclone As New ADODB.Recordset
Static default_val As Integer 'stores the record has been moved to
On Error GoTo Err_cmdNext_Click



Set rst = Me.Recordset
error -->Set rstclone = Me.RecordsetClone
'Debug.Print rst.RecordCount

If Me!cmdPrevious.Enabled = False Then
Me!cmdPrevious.Enabled = True
End If

rst.MoveNext
rstclone.MoveNext


If rstclone.EOF Then
rstclone.MoveLast
Me!cmdPrevious.SetFocus
Me!cmdNext.Enabled = False
Me!cmdFinish.Visible = True
Else
:
:
End If

End If


Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click
End Sub

THIS IS THE OPEN FORM EVENT
Private Sub Form_Open(Cancel As Integer)
Dim prefix As String, lotnum As Integer, sqlstr As String
Dim add_bag_results As New ADODB.Command, rs_add_bag_results As New ADODB.Recordset
Dim update_bags As New ADODB.Command, rs_update_bags As New ADODB.Recordset
Dim work_ord_num As String, work_ord_line_num As String
Dim sampling_data_id As String

'Return selected bags in bag_data not in bag_results.
With add_bag_results
.ActiveConnection = CurrentProject.Connection
.CommandType = adCmdStoredProc
.CommandText = "spSampling_add_bag_results"
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter("@lotnum", adInteger, adParamInput, 4, lot_n)
:
.Execute , , adExecuteNoRecords
End With
Set add_bag_results = Nothing
With add_bag_results
.ActiveConnection = CurrentProject.Connection
.CommandType = adCmdStoredProc
.CommandText = "spSampling_add_bag_results"
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
'.Parameters.Append .CreateParameter("@lotnum", adInteger, adParamInput, 4, rs_add_bag_results(1))
.Parameters.Append .CreateParameter("@lotnum", adInteger, adParamInput, 4, 4120)
:
Set rs_add_bag_results = .Execute
End With

Set Me.Recordset = rs_add_bag_results
Debug.Print Me.Recordset.RecordCount 'CORRECT # OF RECORDS

exit_sub:
rs_add_bag_results.close
Set update_bags = Nothing
Set add_bag_results = Nothing

End Sub

Move Record From One Grid To Another?
I have a form with a MSHFlexGrid (frmInvoice) and I am calling items from a SQL Database to load another MSHFlexGrid (frmChoose). The frmChoose needs to pull up parts from a database. Most parts have 2 choices(OEM and ReMan) When I use the SQL Statement I only get one part and not the other.

"Select * from Parts Where PartName = 'WaterPump'"

I'm sure I have to include the "i" counter but can't quite seem to figure it out.

Also I need to be able to select a row from the frmChoose and add it to the frmInvoice.

I call PartName because even though it's not the primary key, I have taken time to make sure all PartNames are unique.

Every day above ground is a GOOD DAY!!!

Move To Next Record In Database
hey everyone. i've been pulling out my hair at this one for 2 days now . i have tried many of the related topics posted, looked on the help files in vb, and viewed many faq's, but still nothing. this is probably very simple, so no laughing haha!

i have an access database connected to my form. it shows all the records i want it to show in the appropriate places - this is a good start. then i want the user to click the "next" button, and the next set of records to show, but no dice - this is my problem!

i tried making recordsets (examples i got from other users), and i kept getting an error message saying "could not find installable ISAM". so i gave up on that venture.

all i want to do is move to the next record in my database. please, can anyone help me???? i am new to programming, so please be gentle

some of the specs you may need to know are:
*database is saved as "exam.mdb"
*database has fields named "question", "ID", 3 "wrong answers", and a "solution"
*there are 2 labels and 4 radiobuttons that need to be populated
*i am using OleDbDataAdapter to connect

thanks in advance........ryan

Recordset.Move (help)
hi,

i am having problem with Recordset.Move .
i am performing following operation in my programe :-


For j = 1 To RS.RecordCount - i
am = am + RS!TotalAmount
RS.Movenext
Next

then after summing all "TotalAmount" values
i want to move to the first record in the recordset.Do some updation .

Then the whole For loop is run again but now i want to go to Second record in the recordset.So that i could do updation on it
tell me how to use "Recordset.Move" method in it .
i have tried by placing ' RS.Move k ' (k =1 )
but its giving error of BOF and EOF.
give ur solutions plz

Move Through A Recordset
Hi
I have vb6 form that is connected to an SQL server table.
I have 2 command buttonrevious and Next.The command "Previous" move to the previous record in the recordset and next moves to the next record in the recordset,
what i need is when the user clicks on "Previous" to check if the BOF is reached,if yes disable the previous command,the same thing for "Next",when the user clicks on "Next" to check if the EOF is reached,if yes disable the next button

I tried using the following code but it didn't work


VB Code:
Private Sub cmdPrevious_Click()rs.MovePreviousIf rs.bof = True ThencmdPrevious.Enabled = FalseEnd If End Sub Private Sub cmdNext_Click()rs.MoveNextIf rs.EOF = True ThencmdNext.Enabled = FalseEnd If End Sub


Any idea?

Thanks

Move Adodc Record With A Datacombo
I have succesfully created a datacombo and two text boxs bound to a adodc control. I can select any record fron the datacombo but the two fields that that the text boxs are bound to, don't change to match the record in the Datacombo. If I use the ADODC control, I can move through the records and all three fields change. I need to know how to have the datacombo move the current record in the ADODC to match the datacombo. Any help is appreciated.
Thanks
Tom

Move Next Record In Crystal Reports
Hi,
I'm using crystal reports 8.5 and Here is my question.

I need to create a formula fields which looks like this "Dates going to get approval are 1/2/04, 1/5/04,1/6/04 and 1/7/04" I'm picking these dates from Database.

My problem is I can able to get the fist record. How do move to next records. Is there any specifiec way to do this.

Someone please help me.

Thank you.

Regards
Rechen

[VB6 / ADO] Move To Next / Previous Record In A Second Form
Hi,

i have the following problem:

I have a datagrid that's filled with a recordset.
When the users doubleclicks a record, a new detailform is shown with all
info about the record.
Now i want to put 'next/previous' buttons on that detailform so that
the user can skip to the next/previous records from the datagrid in
the underlying window.
The current detailwindow should be updated with the values from the new active record.

Does anyone have a clue how to achieve this?

So far, i managed to do this (code on popup).

Code:
Private Sub cmdNext_Click() ' user clicked "next record"

    Dim v As Variant

    With mainform.DataGrid1
        v = mainform.DataGrid1.GetBookmark(1)
        ' Remove previously saved bookmark from collection
        If .SelBookmarks.Count <> 0 Then
           .SelBookmarks.Remove 0
        End If
        ' Append your bookmark to the collection of selected rows
        If Not IsNull(v) Then
           .SelBookmarks.Add v
        End If
     End With

End Sub


This is what happend when i click the button:
I see the bookmark changing to the next record, but the recordselector
doesn't follow, so this code works only once.

How do i move the selected record in the parent window?

grtz,
Jan

Search Using Adc As A Navigation To Move To Next Record
I have a form (frmSearch) that is filled with labels and textboxes and this frmSearch has an adodc that is connected to a database & table. When the user types in something in one of the textboxes to search, then hits the cmdSearch button, the labels and textboxes are filled with the record that was searched for from the database. The only problem I have is, what if the search produces more than one record? I do I get the adodc navigation buttons to function as clicking on the next record found in the search.
Example: User types in 6412 in Acct textbox. The rest of the textboxes and labels are filled with the record that has acct number 6412. But there are 2 records in the database that have 6412. The textboxes and labels in the form only show the first record found.
Is it possible to click on the -> button on the adodc and display the next record with acct number 6412?

Thanks for the help.
You all are awesome.
vbgeekcoder

Move To Next Record On A Form Programatically
* NOT RESOLVED *

I have an Access 2002 VBA question.

I created a form with a cbo on it that automatically moves to the first record that matches the selected name. The underlying code uses the Find function. After selecting a last name from the cbo, the code functions beautifully, displaying the information I wish to see for that individual. However, when I click on the record navigation buttons at the bottom of the form, the current record count is the only thing that changes.

Example:
I choose "Arndt" from my cbo. The information for Arndt displays. When I click on the record navigation button at the form's bottom, though, the record count increments all the way up to my last existing record, but none of the information displayed changes. That is, "Briley" and her information should display once I move to the next record, but the record count goes from 2 to 3, 4, 5, etc.

How do I enable my users to browse through the entire recordset like normal after jumping to a location within the set?

Many thanks!



Edited by - rhettamoeller on 9/19/2003 9:49:05 AM

Adodc1.recordset.move
does anyone know what code should follow this:
adodc1.recordset.move ?
thanks

Move To New Entry In Recordset
Hi guys:

If I want to add a new record, this will take me to the first record in my database.

'engage for adding new record
frmPersonalDetails.Data1.Recordset.AddNew

'go to first record
frmPersonalDetails.Show 1

but what if I want to add a new entry, and so the record number I would want to show, would be the one following my last entry, which for arguments sake could be 7, so I would want to show 8, or could be 54 so I would want to show 55.


David

Recordset Move Problem
Hello,


i need to read a range of recordsets f.e. recordset 25 to 50 from an access db.

how can i say read from recordset 25 or start with recordset 25 etc ....

i dont get the point with myrecset.move

can anybody please give me some hints.


thx Salva

Move Progress Bar According To RecordSet
Hello
How to move progressbar accroding to Table records
for example
Progressbar.value increase 1+1 when ever Recordset.Move Next play
when recordset.eof=true then the value of progressbar should be on 100%

Please help me

Problem To Move Recordset
I use ADODB to connect my m.access database to visual basic. I created a module named as modConnection which contains the following sub :


VB Code:
Option ExplicitPublic conn As ADODB.ConnectionPublic rst As ADODB.RecordsetPublic strSQL As String Public Sub DBConnection()    Set conn = New ADODB.Connection    Set rst = New ADODB.Recordset         strSQL = "SELECT * FROM [PESAKIT]"    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = DatabasesDBPesakit.mdb;Persist Security Info=False;"          rst.Open strSQL, conn, adOpenForwardOnly, adLockOptimisticEnd Sub


In the Form_Load event, I have the following code to call DBConnection() :


VB Code:
Private Sub Form_Load()    Call DBConnection    rst.MoveFirst    '---- Close all connection ----    rst.Close    conn.Close    Set rst = Nothing    Set conn = NothingEnd Sub


But I found a problem to move the recordset using the following code :


VB Code:
Private Sub cmdNext_Click()    Call DBConnection    If Not (rst.EOF = True) Then         rst.movenext ‘move to next record    End If    '---- Close all connection ----    rst.Close    conn.Close    Set rst = Nothing    Set conn = Nothing          End Sub


Please Help. Thank you in advance.

How To Move The Data Through Recordset
Hye guyz..I have a problem to move the data from one row to another in one table by using 4 buttons (first, next, previous, last). In order to edit the data, i want it to appear in all text boxes and allow the user to select which information that they want to edit..my problem here is, i dont know how to open recordset in the different buttons.

The logic of the system is when the user click on edit button, the frame edit will appear. Here when the user click on edit button, the data in the db will appear in text boxes and combo box. They will select the data by using this 4 buttons. i know that i suppose to open the table when the user click on edit button. But i dont know how to move it from one record to another record.

here, i attached together my interface sample. I really hope that u guyz can help me..

Move Through A Recordset In DataGrid
I need to know how to move through a recordset and have the record that the recordset is pointing to to be selected in the datagrid. In other words I just want to move through the datagrid with command buttons. I can do it in in the recorset but not with the datagrid.

Any help please thanks in advance

Brent

Move Recordset Pointer
Hi all,
Does any one know how move the recordset to the particular record,
recordset.move method is moving recorset for mentioned number
I mean I want recordset to move at for e.g record no.5
I am generating random no, and I want to move the recordset to that no. and display the record,
but how
is it possible
thanx in advance
Gary

With Data Enviroments, How To Move A Record From One Database To Another
I wish to transport a record in an access database to another access database (which has the asme fileds etc)

Im useing dataenviroments to read and manipulate the databases at the moment.

I wish to take say a customer order record and take it from the current datase and place it into the invoice history database.

Is there a simple command to transfer whole database records, or do i ahve to use the data enviromets to move over 1 field in the record at a time.

Many thanks

Move To The Last Record You Stupid Pointer Problem!!!
Code:
rsMyRS.MoveLast


Shouldn't this move to the last record in a table? All it seems to do for me is move to the next record. What is the proper way to move to the last or bottom record of a table with looping?

VB To Access 2000; Move To Last Record And Update
I want to move straight to the end of a database and add a new record.

I have been using the ADO control to scroll to the last record and it updates just fine, but I feel there must be a better way. What I would like it to do is, arrive straight at the blank record without the scrolling.

This is what I have tried so far;

I have been loading the form with code, which does bring up the new blank record, but doesn’t let me update it, when I come to use the .AddNew

The ADO control property EOF Action is set to:     2adDOAddNew

The form load code is as follows;

Private Sub Form_Load()

   With Adodc1.Recordset
       .MoveLast
       .MoveNext
   End With

End Sub

Any suggestions would be most welcome


[NOT RESOLVED] Move To Specific Record On A Subform
Hello all!

I have a form with two sub forms, and a listbox. On this form I display information about assets. In the listbox I indicate a type of asset (pc, laptop, mouse, etc.)
Then the first subform shows all brands of assets of that type. The second subform shows all actual assets, with their tag number etc. per brand I select in the first subform.
This all works very smoothly.

Now the problem is that when I try to filter the form on a specific asset (eg. by tag, to find out what kind of asset it is, and which brand), the combobox and the first subform do not reflect this.

I also have a form with user information. This form also has a subform with all assets allocated to that specific user. When I doubleclick the subform, I would like to open the assets form, and move to the specific asset.

Somehow I do not seem to get it to work. Any ideas are welcome!

SpSp



Edited by - sergeb on 6/26/2003 4:59:14 AM

.Move Or Some Other Method To A Specific Recordset?
Is there some sort of move method in which I can move the pointer to a specific record at run-time?

Here is my problem:

Table1:Customer           
CusterID
LastName
FirstName
.....

Table2:CustomerAccount
AccountID
CustomerID

Many-to-Many relationship:  Many customers can have Many accounts

I have set up navigation buttons:  First, Next, Previous, Last.  They work great for navigatin the Customer table because every CustomerID in that table is a single entry.  However, not the case in the CustomerAccount table.  In which enteries look like this:

AccountID    CustomerID
11111001      1001001
11111001      1001002
11111002      1001001
11111002      1001002

I need to be able to retrieve at run-time from text box "txtCustomerID" and use it to find the corresponding value in the CustomerAccount table to set the pointer.  This way I can get the navigation buttons to show the corresponding AccountIDs associated with each CuctomerIDs.  I can only navigate with the Customer table info right now.

Thanks,
KellyPutty

HELP PLEASE.....Move Through An Existing Recordset [Self Resolved]
I have a form where the user inputs the person's First Name or Last Name Or Company Name and it searchs the data base for all the matchs for any fields that match the user's input. Now when the recordset is built I want the user to be able to move through them to find the person's information they want. Here is the code for the search button on my form. I have the text boxes bound to the datafields and if the person does not exist in the database I have a button to add them.

Code: Private Sub Command4_Click()

'Looks up User Input from Contacts Database
    Me.MousePointer = vbArrowHourglass
    
  Dim db As Connection
  Set db = New Connection
  db.CursorLocation = adUseClient
'EDG Client Transmittal Database
    db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:VBA Project StuffEdg TransmittalTransmittal.mdb;"

  Set adoPrimaryRS = New Recordset

  adoPrimaryRS.Open "select FirstName,LastName,CompanyName,Address,Address2,City,State,PostalCode,WorkPhone from Contacts where FirstName = '" & txtFields(0) & "' OR LastName = '" & txtFields(1) & "' OR CompanyName = '" & txtFields(2) & "'", db, adOpenStatic, adLockOptimistic
    
   If adoPrimaryRS.EOF = False Then
    
'Binding Input Boxes To Database Information Returned By Search
    Set txtFields(0).DataSource = adoPrimaryRS
    txtFields(0).DataField = "FirstName"

    Set txtFields(1).DataSource = adoPrimaryRS
    txtFields(1).DataField = "LastName"

    Set txtFields(2).DataSource = adoPrimaryRS
    txtFields(2).DataField = "CompanyName"
    
    Set txtFields(3).DataSource = adoPrimaryRS
    txtFields(3).DataField = "Address"
    
    Set txtFields(8).DataSource = adoPrimaryRS
    txtFields(8).DataField = "Address2"
    
    Set txtFields(4).DataSource = adoPrimaryRS
    txtFields(4).DataField = "City"
    
    Set txtFields(5).DataSource = adoPrimaryRS
    txtFields(5).DataField = "State"
    
    Set txtFields(6).DataSource = adoPrimaryRS
    txtFields(6).DataField = "PostalCode"
    
    Set txtFields(7).DataSource = adoPrimaryRS
    txtFields(7).DataField = "WorkPhone"

    Else
    txtFields(0).Text = ""
    txtFields(1).Text = ""
    txtFields(2).Text = ""
    MsgBox "Client Information NOT in Database"
    End If

    adoPrimaryRS.Close
    Set adoPrimaryRS = Nothing

  Me.MousePointer = vbDefault
End Sub


Any help would be greatly appreciated.

Thanks, Stan



Edited by - skeeley6 on 10/18/2005 7:04:34 PM

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