Operation is not support...

  • Thread starter Thread starter ramon
  • Start date Start date
R

ramon

Hi! Could anyone please help me with my problem. I am
developing a database in Ms Access and I have this form
use for searching a particular record. My problem is when
I try to click the "OK" command button to start searching
I get a Ms Access message which is "Operation is not
supported for this type of object."

Below is my part of source code & the numbers to the left
are only for reference. The Ms Access message that I
have mentioned appears in lines 5 & 7.

1. Dim rstCurrent As Recordset, txtOrderno As String,
txtLocation As String, dtmUpdateOn As Date

2. 'set variable
3. Set dbsCurrent = CurrentDb()
4. Set rstCurrent = dbsCurrent.OpenRecordset("ROME")
5. rstCurrent.Index = "ORDERNO"

6. 'search for SAP
7. rstCurrent.Seek "=", Sap2Search

8. 'check if no match found
9. If rstCurrent.NoMatch Then
 
Thanks for your reply. Yes, the 'ROME' is a linked
table. Is there any way around with this problem? The
database that I am developing is using a 'back-end'
& 'front-end' system.
 
There are at least three ways around the problem. The following examples are
from memory, and have not been tested, so it is possibly they may contain
typos or syntax errors, but they should serve to get you started - for more
information, you can paste these examples into the VBA editor, place the
insertion point in any of the keywords, then press F1 to get help on that
key word.

1) Use FindFirst instead of Seek:

Set rst = db.OpenRecordset(Whatever)
rst.FindFirst "SomeField = SomeValue"

2) Use a SQL statement to open a recordset containing only the record you
want:

Set rst = db.OpenRecordset("SELECT * FROM SomeTable WHERE SomeField =
SomeUniqueValue")

3) Open a database object on the back-end database directly, then you can
use Index and Seek:

'Using the Connect property of the linked table to
'get the path to the back-end database - the path is
'everything after the '=' in the Connect string.

strConnect = CurrentDb.TableDefs("ROME").Connect
strConnect = Mid$(strConnect, InStr(1, strConnect, "=") + 1)

Set db = DbEngine.OpenDatabase(strConnect)
Set rst = db.OpenRecordset(Whatever)
 
Back
Top