4

I am working with an Access database and it has a form and VBA behind it. It has been quite a while since I dabbled in VBA and my google-fu is failing me right now so bear with me.

I created a simple class, and I am getting a compile error:

Dim oRecordSet As ADODB.RecordSet
Public Property Get RecordSet() As ADODB.RecordSet
    RecordSet = oRecordSet '' error here
End Property

Public Property Let RecordSet(ByVal val As ADODB.RecordSet)
    RecordSet = val
End Property

I have a couple other identical properties (different names/variables, obviously) that compile just fine; their types are String and Integer.

What am I missing? Thanks!

Also a side note, when I am coding the intellisense shows ADODB.Recordset, but on autoformat (carriage return, compile, etc) it changes it to ADODB.RecordSet. Need I be worried?

braX
  • 11,506
  • 5
  • 20
  • 33
Anders
  • 12,088
  • 34
  • 98
  • 146
  • Objects are set using *Set*. All value types are OK with just =. So, Edmin is right about the cause of the error. – Igor Turman May 07 '12 at 05:14

1 Answers1

7

It should be:

Public Property Get RecordSet() As ADODB.RecordSet
    Set RecordSet = oRecordSet '' error here
End Property
Edwin Bautista
  • 463
  • 3
  • 17