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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi! I allways use something like

Status
Not open for further replies.

tomvdduin

Programmer
Sep 29, 2002
155
NL
Hi!

I allways use something like this in ADO to get a recordset, but suddenly it gives an error on rstPERSOON.index = "p_id"!

' zoek gegevens van de persoon op
rstPERSOON.open "tbl_PERSOON", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rstPERSOON.Index = "p_id"
rstPERSOON.Seek persoon

The errornr I am getting is 3251. It saids that something of the index-function isn't supported (I can't realy translate it from dutch into english)

It always has worked!! I can change it into:
rstPERSOON.open "select * from tbl_PERSOON where p_id = " & persoon
'couse that works fine, but it's not funny to change I think 40 of those statements... Beside that, it has always worked, so why not now?

This is the whole piece of code:

Private Sub btn_print_etiket_Click()
On Error GoTo error_trap

Dim cnn As Connection
Dim rstPE As New ADODB.Recordset
Dim rstPERSOON As New ADODB.Recordset
Dim rstPERSOON_volw As New ADODB.Recordset
Dim rstTemp As New ADODB.Recordset
Dim strNaam As String
Dim intTeller As Integer

Set cnn = CurrentProject.Connection
' start een transactie vóór de wijziging van gegevens!
cnn.BeginTrans

' zoek gegevens van de persoon op
rstPERSOON.open "tbl_PERSOON", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rstPERSOON.Index = "p_id"
rstPERSOON.Seek persoon

' zoek gegevens van de volwassen persoon op
rstPERSOON_volw.open "tbl_PERSOON_volw", cnn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
rstPERSOON_volw.Index = "p_id"
rstPERSOON_volw.Seek persoon

' zoek gegevens van de PE op
rstPE.open "tbl_PE", cnn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
rstPE.Index = "pe_id"
rstPE.Seek rstPERSOON!pastorale_eenheid

strNaam = VolledigeNaam_recset(rstPERSOON, rstPE, rstPERSOON_volw)

rstTemp.open "tbl_TEMP_etiketten", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rstTemp.Index = "p_id"

rstTemp.AddNew
rstTemp!p_id = rstPERSOON!p_id
rstTemp!naam = strNaam
rstTemp!user = CurrentUser

rstTemp.Update
cnn.CommitTrans

DoCmd.OpenForm "frm_ETIKETTEN_selectie", acNormal

' Dim stDocName As String
'
' stDocName = "rpt_ETIKET_selectie"
' DoCmd.OpenReport stDocName, acNormal, wherecondition:="[p_id] = " & persoon

exit_form:
Exit Sub

error_trap:

log_error CurrentUser, Err.Number, Err.Description, Me.Module.Name & "-" & "btn_print_etiket_Click"

If IsGeladen(Me.Name) Then DoCmd.Close acForm, Me.Name, acSaveNo
cnn.RollbackTrans
Resume exit_form

End Sub


I hope
 
Have you recently changed backend databases or upgraded MDAC? Sounds like setting the index property of the recordset is not supported any longer. You could try changing recordset type from adOpenKeyset to something else.
 
It may not be a bad idea to check your references and make sure they are still all OK.

Good Luck
ssecca
 
There I am again! Yes, I splitted the DB into a backend and frontend. Is that the problem? What can I do about it?

btw all the references are OK
 
Seek is not supported for linked tables. You CAN instantiate the Backend db as an object in the front end and use seek, however this is probably at least as much 'work' as re-writting the SQL statements and also slower in performance. Another approach (also involves some re-writting of code) is to just use the find method.

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top