Configuring visibility for a tab control page by setting an On Current event on a continuous form

Arcanant

New member
Local time
Today, 19:22
Joined
Jun 4, 2022
Messages
12
This is my first question post so sorry if not everything is clear, I am still getting the hunk of it. I am a very novice beginner willing to learn ^_^

I am trying to set up an order form for purchase of optionally more than one product that each have different customization options based on their category they belong to. The main form contains details about order number, customer, destination and in a subform a continuous form for adding the different products.
So far, I made (in the subform) a combo box that autofill based on choice the standard fields that is for every product. I added a tab control with different pages for each category of product that includes the fields for the different options. I am trying to set up a trigger event to change the visibility of the pages based on the category that gets autofill from the combo box choice when a product is chosen. My attempt:

VBA set an on Current event on the sub(continuous)form

Code:
if me.category.value = Chair then
Me.tabctrlproductoptions.Pages(Chair).visible =True else
Me.tabctrlproductoptions.Pages(Chair).visible = False
end if


I am getting an Error message when I try to reopen the form

Object doesn't support this property or method (Error 438)​

If anyone has a take on this, I would very much appreciate it. I am open to alternative methods and ideas if what I try to do is not possible. Thank you in advance for your input.
 
Hi. If Chair is the name of your tab page, then try enclosing it in quotes. For example:

.Pages("Chair")

Same thing with your If statement.

If Me.Category.Value = "Chair"
 
So I configured the code like this

Code:
Option Compare Database


Private Sub comboChooseProduct_AfterUpdate()






End Sub


Private Sub Form_Current()


If Me.category.Value = "Chair" Then
Me.TabCtlproductoptions.Pages("Chair").Visible = True
ElseIf Not Me.category.Value = "Chair" Then
Me.TabCtlproductoptions.Pages("Chair").Visible = False
End If


End Sub

I am not getting any errors but it doesn't seem to do what I ask of it. Any ideas?
 
So I configured the code like this

Code:
Option Compare Database


Private Sub comboChooseProduct_AfterUpdate()






End Sub


Private Sub Form_Current()


If Me.category.Value = "Chair" Then
Me.TabCtlproductoptions.Pages("Chair").Visible = True
ElseIf Not Me.category.Value = "Chair" Then
Me.TabCtlproductoptions.Pages("Chair").Visible = False
End If


End Sub

I am not getting any errors but it doesn't seem to do what I ask of it. Any ideas?
Hi
Are you able to upload the database without any Confidential data?
 
Hello and ty very much. I can since all the info is fake anyway for practice but I am afraid everything is in Greek ... 😕 I have split the tables and the forms in separate files. The tables are in the folder "ΠΙΝΑΚΕΣ", you can update and re-link them at the Styllas(1).accdb file. The form I am trying to manipulate is the ΦΟΡΜΑ_ΠΑΡΑΓΓΕΛΙΩΝ_ΠΩΛΗΤΩΝ. The field in the sub form that I am referencing at is the ΚΑΤΗΓΟΡΙΑ, the combo box is called ΕΠΙΛΟΓΗ ΠΡΟΪΟΝΤΟΣ. It is a bit too much to translate everything but I am willing to go in live chat to translate live any relevant info.
 

Attachments

Hello and ty very much. I can since all the info is fake anyway for practice but I am afraid everything is in Greek ... 😕 I have split the tables and the forms in separate files. The tables are in the folder "ΠΙΝΑΚΕΣ", you can update and re-link them at the Styllas(1).accdb file. The form I am trying to manipulate is the ΦΟΡΜΑ_ΠΑΡΑΓΓΕΛΙΩΝ_ΠΩΛΗΤΩΝ. The field in the sub form that I am referencing at is the ΚΑΤΗΓΟΡΙΑ, the combo box is called ΕΠΙΛΟΓΗ ΠΡΟΪΟΝΤΟΣ. It is a bit too much to translate everything but I am willing to go in live chat to translate live any relevant info.
Just sent you a Conversation request
 

Users who are viewing this thread

Back
Top Bottom