Hi everyone,
I would like to know if the following is possible: I have a table, I have a form based on that table (datasheet view) and I would like for certain columns to visible or not based on the input on a Combobox (list of countries) that is based on another form.
I have searched on the web and I found that the following:
On a button based on the main menu form:
and then on the event "on open" of the form Datasheet I have inserted the following:
I have done it as a test, but it appears that it does not work. It opens the forms, but it does not hide or show the columns based on the option, it brings all the columns. Could you please help me?
Thanks in advance!
I would like to know if the following is possible: I have a table, I have a form based on that table (datasheet view) and I would like for certain columns to visible or not based on the input on a Combobox (list of countries) that is based on another form.
I have searched on the web and I found that the following:
On a button based on the main menu form:
Code:
Private Sub Go_Click()
Dim stDocName As String
Dim stOpen As String
stOpen = Me!cboDest
stDocName = "Datasheet"
DoCmd.OpenForm stDocName, , , , , , stOpen
and then on the event "on open" of the form Datasheet I have inserted the following:
Code:
Private Sub Form_Open(Cancel As Integer)
Select Case OpenArgs
Case "USA"
Forms![Overflow]![Tasks].Visible = True
Forms![Overflow]![Constant Number (Min)].Visible = True
Forms![Overflow]![Country].Visible = True
Forms![Overflow]![Transactional Time (Min)].Visible = True
Forms![Overflow]![Business Visitor].Visible = True
Forms![Overflow]![Non-Visa Required].Visible = True
Forms![Overflow]![Work Permit (Home India)].Visible = True
Forms![Overflow]![Work Permit (Home Phillipines)].Visible = True
Forms![Overflow]![Work Permit (ROW)].Visible = True
Forms![Overflow]![P750].Visible = True
Forms![Overflow]![P44].Visible = True
Forms![Overflow]![Complex].Visible = True
Forms![Overflow]![Outbound].Visible = True
Forms![Overflow]![Inbound Compliance].Visible = True
Forms![Overflow]![Inbound Non Compliance].Visible = True
Forms![Overflow]![Inbound Prior Years].Visible = True
Forms![Overflow]![Outbound Equalized].Visible = True
Forms![Overflow]![Outbound Not Equalized].Visible = True
Forms![Overflow]![Inbound Compliance].Visible = True
Forms![Overflow]![EEAA].Visible = False
Forms![Overflow]![Work Permit].Visible = False
Forms![Overflow]![Schengen].Visible = False
Case "United Kingdom"
Forms![Overflow]![Tasks].Visible = True
Forms![Overflow]![Constant Number (Min)].Visible = True
Forms![Overflow]![Country].Visible = True
Forms![Overflow]![Transactional Time (Min)].Visible = True
Forms![Overflow]![Business Visitor].Visible = False
Forms![Overflow]![Non-Visa Required].Visible = False
Forms![Overflow]![Work Permit (Home India)].Visible = False
Forms![Overflow]![Work Permit (Home Phillipines)].Visible = False
Forms![Overflow]![Work Permit (ROW)].Visible = True
Forms![Overflow]![P750].Visible = True
Forms![Overflow]![P44].Visible = True
Forms![Overflow]![Complex].Visible = True
Forms![Overflow]![Outbound].Visible = True
Forms![Overflow]![Inbound Compliance].Visible = True
Forms![Overflow]![Inbound Non Compliance].Visible = True
Forms![Overflow]![Inbound Prior Years].Visible = True
Forms![Overflow]![Outbound Equalized].Visible = True
Forms![Overflow]![Outbound Not Equalized].Visible = True
Forms![Overflow]![Inbound Compliance].Visible = True
Forms![Overflow]![EEAA].Visible = True
Forms![Overflow]![Work Permit].Visible = True
Forms![Overflow]![Schengen].Visible = True
Case Else
'Nothing
End Select
End Sub
I have done it as a test, but it appears that it does not work. It opens the forms, but it does not hide or show the columns based on the option, it brings all the columns. Could you please help me?
Thanks in advance!