Hi!
I am trying to hide certain columns in a subform but somehow it doesn't work
My subform shows more columns than I need for one application,
so upon a button click I run a certain SQL code (via VBA) and with the same click I would like to hide the abundant columns.
Code:
Private Sub btCompose_Click()
'shows the new samples that have to be in an experiment
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim VarItm As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("qrBiopt_iso")
strSQL = "SELECT tblSamples.Sample_name, tblSamples.Primary_tumor_type, tblSamples.Biopsy_material, tblSamples.Sample_barcode AS [Biopsy barc 1], " & _
"tblSamples.Biopsy_barc_2, tblSamples.Biopsy_barc_3, tblSamples.Biopsy_barc_4, tblSamples.Coupes_barcode, tblSamples.Pathologie_exp , tblSamples.Tumor_ " & _
"FROM tblSamples " & _
"WHERE tblSamples.Pathologie = 'Finished';"
qdf.sql = strSQL
Set db = Nothing
Set qdf = Nothing
'change record sourse for the subform to match strSQL, and update the subform
Forms!Biopsy_iso!Sub_iso_biopsy.Form.RecordSource = strSQL
'suppose to hide patient name collumn but doesnt work
Forms![Biopsy_iso]![Sub_iso_biopsy].Form![Patient_name].ColumnHidden = False
End Sub
I thought it wouldn't be this complicated but somehow I do something wrong...