Invalid use of property?

I work with an Access database and it has a form and VBA. It's been a while since I chatted in VBA and my google-fu is not giving me right now, so bear with me.

I created a simple class and I get a compilation 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 of other identical properties (different names / variables, obviously) that compile just fine; their types are String and Integer .

What am I missing? Thanks!

Also note that when encoding, intellisense shows ADODB.Recordset , but with autoformat (carriage return, compilation, etc.), it changes it to ADODB.Recordset . Do I need to worry?

+4
source share
1 answer

It should be:

 Public Property Get RecordSet() As ADODB.RecordSet Set RecordSet = oRecordSet '' error here End Property 
+7
source

Source: https://habr.com/ru/post/1411051/


All Articles