Hey thanks for the reply, actually im still a newb in VB and SQL and I'm not sure where and how to fit the code you gave me.
Currently when I click on the report button it opens a report with the current record. The code is:
Private Sub reportbtn_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Showroom1", acViewPreview, , strWhere
DoCmd.OpenReport "Showroom2", acViewPreview, , strWhere
Now if I want the field EN01 to DISAPPEAR if its 4, how do I incorporate that into the code?
What you want to do, is right click on the report in the objects pane on the left hand side of access 2007 and select "design view" then in the properties sheet, select the events tab and click on the button beside "on open" event, this will bring you to the vba editor window where you can write code that will execute in the report open event. (when the report is opened)
I've attached a screen cap, have a look at it below.
You also may want to read a little on vba, it's an easy language, just requires a little reading and practice.
field en01 is bound to what control on the report ? textbox, combobox ? whatever control that field is bound to, all you have to do is simply:
If [En01] = 4 then txtboxEN01.visible = false
this code would go in the open event of the report, so when the report opens up, then it checks the field value if it's 4, and makes the control (combo box, checkbox, text box, whatever the control is) invisible, by setting it's visible property to false
it's not the field that you can make invisible, it's the control. A bound control to a specific field. You evaluate the field by:
If EN01 = 4 then [Control1].visible = False
EN01 is a field
but which control is this field bound to ? a combo box, a text box ? a checkbox ? what's the name of the control/checkbox?, whatever the name is, that's what u will use in vba to set it's visible property to false. You can't set a field's visible property, it's a field, you need to set the bound control's visible property to false