Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Inspections should be aware of control names on Access forms and reports. #928

Open
ThunderFrame opened this Issue Jan 12, 2016 · 2 comments

Comments

Projects
None yet
4 participants
@ThunderFrame
Copy link
Member

ThunderFrame commented Jan 12, 2016

Access forms are different to VB Forms. Access Forms and Reports have their own set of properties, methods and events. Code Inspector needs to be aware of the "undeclared" members.

Private Sub cmdOK_Click()

  'cmdOK is a CommandButton on an Access Form
  'txtName is a TextBox control on an Access Form
  'Firstname and Lastname are fields in the underlying recordset

  'These 3 lines are functionally equivalent, and operate on a control on the form
  txtName.Value = "Smith"
  Me.txtName.Value = "Smith"
  Me.Controls("txtName").Value = "Smith"

  'These 2 lines are functionally equivalent, and operate on a property of the form
  Debug.Print Recordset.EOF
  Debug.Print Me.Recordset.EOF

  If Me.Recordset.EOF Then
    'This returns Null
    Debug.Print Me!Lastname
    'This causes an error, because EOF!
    Debug.Print Recordset!Lastname
  Else
    'These 2 are functionally equivalent
    Debug.Print Me!Lastname
    Debug.Print Recordset!Lastname

    'And this mixes the approach
    Debug.Print Me!FirstName & Recordset!Lastname

  End If

  'RubberDuck Code Inspection will think txtName and/or Recordset are undeclared?

End Sub
@rubberduck203

This comment has been minimized.

Copy link
Member

rubberduck203 commented Jan 12, 2016

I won't lie. I've been meaning to do this for a while and have been slacking. Unfortunately, I'm the only Access dev on the project and have been tied up for quite some time.

@Hosch250

This comment has been minimized.

Copy link
Member

Hosch250 commented Jun 10, 2016

Still a big problem with inspections about events and such not being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.