Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Move numrecords, start: method problem

Status
Not open for further replies.

Penrodcigar

Technical User
Aug 23, 2006
19
0
0
US
Using the .Move numrecords, start: method Access gives me the error message “Sub or Function not Defined”. The actual lines of code read:

Dim PrIDVar As String
PrIDVar = Me.Face.Value ‘where the value is the
row selected with a combo box
that has the bound column set
to “0” ie 7 for the 8th row of
the table selected in the
combo box)
Dim myConnection As ADODB.Connection
Set myConnection = CurrentProject.Connection
Dim myRecordset As New ADODB.Recordset
myRecordset.ActiveConnection = myConnection
myRecordset.Open "SELECT Products.Face, Products.[Product
Supplier], ....sql statement etc...FROM
Products ORDER BY Products.Face"
myRecordset.Move numrecords("PrIDVar") ‘to move the curser
to the intended
row of the table

Here is where the compiler gives me the error message. What have I missed here?
 
Do you in fact have a function called numrecords?
 
I think Penrodcigar, you've confused the argument "NumRecords"
With the actual expression.

The numRecords argument, simply implies, an long value is required,
to move the cursor, that many increments.
In other words, using the PriDVar, will not move the cursor
to that record, but depending on the value,
move it FORWARD, that many times.

myRecordset.Move 6 will move your cusor position,
6 records forward
myRecordset.Move -6 will move your cusor position,
6 records backwords.

To specify a specific record, use Find

myRecordset.Find "pkId =" & PrIdVar
 
Penrodcigar

Your way of openning the recordset would provide a forward-only, read-only cursor located on the server.
Also check, before moving, EOF and BOF When both true you have no record.
And myRecordset.Move 0 would stand still and not move to the next one.

Zion's suggestion
myRecordset.Find "pkId =" & PrIdVar

assumes that pkId is nymeric. You dim it like a string, in that case
myRecordset.Find "pkId ='" & PrIdVar & chr(39)
 
Yes, thank you, I think some secretary typing up the user manual trasposed the writer's shorthand "numrecord" literally. It's working now.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top