UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Run-time error 3251: Operation is not supported for this type of    
 
   
Lin100
post Nov 1 2006, 12:58 PM
Post#1



Posts: 648
Joined: 20-August 06



Run-time error 3251: Operation is not supported for this type of object
ellow highlight is at ---> .Index = "PrimaryKey"
////////////////////////////////////////////////////////////////
Private Sub Convert_To_New_Unit_Number_1C_Click()
Dim Dbs_Unit_Number As DAO.Database
Dim Dbs As DAO.Database
Dim Recordset_Changed_Table As DAO.Recordset
Dim Recordset_Unit_Table As DAO.Recordset
Dim Var_Unit_Number As String
Dim i As Integer
i = 0
Set Dbs_Unit_Number =
OpenDatabase("\\SDASFA01\ACSHARE\ACCESS PROJECT\Account_Unit_Finite_Conversion.mdb")
Set Dbs = CurrentDb
Set Recordset_Unit_Table = Dbs_Unit_Number.OpenRecordset("Unit_Table", dbOpenDynaset)
Set Recordset_Changed_Table = Dbs.OpenRecordset("TblSLS_CHARGE_INFO", dbOpenDynaset)

Recordset_Changed_Table.MoveFirst
While (Not Recordset_Changed_Table.EOF) And (Not Recordset_Changed_Table.BOF)
i = i + 1
Var_Unit_Number = Recordset_Changed_Table![Unit #]
Txt_Unit_Count.Value = i

With Recordset_Unit_Table
.Index = "PrimaryKey" <----------------------- VBA YELLOW HIGHLIGHT. ERROR
.Seek "=", Var_Unit_Number
Recordset_Changed_Table.Edit
Recordset_Changed_Table!New_Unit_Number = Recordset_Unit_Table!New_Unit_Number
Recordset_Changed_Table.update
End With

Recordset_Changed_Table.MoveNext
DoEvents
Wend
MsgBox "Finished Processing!"
End Sub
Go to the top of the page
 
fkegley
post Nov 1 2006, 01:09 PM
Post#2


UtterAccess VIP
Posts: 23,755
Joined: 13-January 05
From: Mississippi


If this is a linked table, then the Indexes aren't available to this database. I think Seek will also be rejected for the same reason.
Edited by: fkegley on Wed Nov 1 13:09:44 EST 2006.
Go to the top of the page
 
Lin100
post Nov 1 2006, 01:34 PM
Post#3



Posts: 648
Joined: 20-August 06



Hi fkegley. The three statement below indicates that it is not a linked table. There are no linked
tables in my database.
et Dbs_Unit_Number = OpenDatabase("\\SDASFA01\ACSHARE\ACCESS PROJECT\Account_Unit_Finite_Conversion.mdb")
Set Recordset_Unit_Table = Dbs_Unit_Number.OpenRecordset("Unit_Table", dbOpenDynaset)
NOT A LINKED TABLE
Set Recordset_Changed_Table = Dbs.OpenRecordset("TblSLS_CHARGE_INFO", dbOpenDynaset)
Go to the top of the page
 
cheekybuddha
post Nov 1 2006, 03:57 PM
Post#4


UtterAccess VIP
Posts: 10,647
Joined: 6-December 03
From: Telegraph Hill


Hi guys.
mm....
Ohaven't got Access here to test but it could be that the line throwing an error is doing so because it thinks you are trying to 'assign' the .Index property.
Also, IIRC, you specify the index in the .Seek statement.
I would try:
' ...
With Recordset_Unit_Table
.Seek "PrimaryKey =", Var_Unit_Number
' ... etc.
hth,
d
Go to the top of the page
 
fkegley
post Nov 1 2006, 03:57 PM
Post#5


UtterAccess VIP
Posts: 23,755
Joined: 13-January 05
From: Mississippi


But still, you are opening a REMOTE database via code, so it might as well be a linked table. I think the problem here is that you cannot get at a table in a REMOTE database the way you are trying to do it. It will let you open the table, however, it cannot get at the indexes associated with the table as you are trying to do it, I don't know if there is a way or not.
Go to the top of the page
 
Lin100
post Nov 1 2006, 04:26 PM
Post#6



Posts: 648
Joined: 20-August 06



Thank you all for helping. I got it figured out.
It needs to be dbOpenTable
et Recordset_Unit_Table = Dbs_Unit_Number.OpenRecordset("Unit_Table", dbOpenDynaset)
Go to the top of the page
 
fkegley
post Nov 1 2006, 04:31 PM
Post#7


UtterAccess VIP
Posts: 23,755
Joined: 13-January 05
From: Mississippi


Glad you got it! I learned something, too, which is nice for me.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th December 2018 - 02:40 PM