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

Invalid use of property ...

Status
Not open for further replies.

tinymind

Programmer
Nov 9, 2000
90
GB
hello all ... I have a problem ... why today of all days ... its friday ...

My code ...

Dim PatientDemogRst As Recordset
Dim MstrRevAnalRst As Recordset
Dim db As Database
Dim thisdb As Database

Set db = CurrentDb
Set thisdb = CurrentDb
GetPatientDemographics = False

Set PatientDemogRst = db.OpenRecordset("PatientDemog")
PatientDemogRst.Index = "FacAcc"

I am trying to index the field "Facacc" in this code ... Error message says ... Operation is not supported for this type of object...

Is their anything wrong with this? It is working in another of my apps without a problem ...

Tiny ... Perfection is Everything
If it worked first time we wont be here!
 
Sorry not entirely clear what you want here- are you saying you want to select only those records from PatientDemog where a field called Index is Facacc? If so something like this should do it:
Set PatientDemogrst = CurrentDb.OpenRecordset("SELECT * FROM [PatientDemog] WHERE (([PatientDemog].[Index] =
" & Facacc & "));")

If not, could you explain a little more please- I am no expert- and also confirm which version you are using. Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Sorry for the delay ....

I am trying to find the correct patient address to the facacc ...

Dim db As Database
Dim patientDemogRst1 As Recordset
Dim MstrRevAnalRst As Recordset

Set db = CurrentDb
GetPatientDemographics = False

Set patientDemogRst1 = db.OpenRecordset("PatientDemog")
patientDemogRst1.Index = "FacAcc"
patientDemogRst1.Seek "=", FacAcc
If patientDemogRst1.NoMatch Then
' do nothing ... for the moment ...
Else
ThisPatient.Title = IIf(IsNull(patientDemogRst1![Title]), " ", patientDemogRst1![Title])
ThisPatient.Forename = IIf(IsNull(patientDemogRst1![Forename]), " ", patientDemogRst1![Forename])
ThisPatient.Surname = IIf(IsNull(patientDemogRst1![Surname]), " ", patientDemogRst1![Surname])
ThisPatient.Address1 = IIf(IsNull(patientDemogRst1![Address1]), " ", patientDemogRst1![Address1])
ThisPatient.Address2 = IIf(IsNull(patientDemogRst1![Address2]), " ", patientDemogRst1![Address2])
ThisPatient.Address3 = IIf(IsNull(patientDemogRst1![Address3]), " ", patientDemogRst1![Address3])
ThisPatient.PostCode = IIf(IsNull(patientDemogRst1![PostCode]), " ", patientDemogRst1![PostCode])
ThisPatient.DOB = patientDemogRst1![DOB]
GetPatientDemographics = True
End If
End Function


When I run this it brings u an error ... Operation is not supported for this type of object...

What is wrong with the code ...

Tiny ... Perfection is Everything
If it worked first time we wont be here!
 
MMmm, can't see an obvious problem, but as I said I'm no expert. One thought though, if the same code works in another app, is it a version problem? If you are using Access 2000 then its default object collection is ADO, your code is written for DAO.

You could check that the DAO 3.6 object library is checked (tools, references from the code window) and maybe be more specific with the code ie Dim rst As DAO.Recordset etc.

HTH Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
I have tried to be more specific and use ...

Set PatientDemogRst = db.OpenRecordset("PatientDemog", dbOpenDynaset)

it still brings up ...

PatientDemogRst.Index = "FacAcc" ....

Operation is not supported for this type of object ...

the DAO library is okay ... as is the other VBA references ...

... there has to be simple solution to this ....

Tiny ... Perfection is Everything
If it worked first time we wont be here!
 
Resolved the issue ....

Access 97 does not like linked tables, and does not recognise it as an object ...

So the data object (PatientDemog) has to be transfered into the database ...

Tiny ... Perfection is Everything
If it worked first time we wont be here!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top