0

pretty simple question here in scope.

Question: Wondering If I would be able to hide the tabs of a form based off the values of a table's fields.

I have been reading the 2019 Access Bible and so far it is still unclear to me how I would write the VBA module to constantly be running. Im asking the question a little early in my attempts, but hoping I can ask this well enough to get a head start.

I dont quite understand the execution model of VBA for access yet. I have prior expierence coding but this will be my 1st time in access. Just looking for a little help on how to write the function scope. You see below that I think it should be "Main" something, as I want it to run whenever in form view. Like I know how to write Private sub functions to respond to a button click. But not for a function that just runs in the background of the form.

I was thinking something along the line of this below.

Main function()
If Me.FieldProcess_Water = "1" Then
Me.TabProcess_Water.Visible = True
Else
Me.TabProcess_Water.Visible  = False
End If
End Sub

enter image description here

2
  • 1
    Hi, and welcome to dba.se! This is a Visual Basic issue and has nothing to do with databases - please ask this question on StackOverflow! You'll be more than welcome back when you have a question or questions about databases! Best...
    – Vérace
    Commented Feb 10, 2022 at 7:02
  • ^I did not realize! Im sorry!
    – Brandon G
    Commented Feb 10, 2022 at 15:37

1 Answer 1

0

The code looks good. The point is: when to execute? In this case there are two events that should trigger the code: the Form_Current event for the form (showing a record) and the After_update event for the FieldProcess_Water control.

1
  • This got me going in the right direction. Gave me the awareness that I needed to dig into the documentation more. Thank you sir.
    – Brandon G
    Commented Feb 10, 2022 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.