Thanks for reply.The way the code in the on current event of the form is set up now where you have code preceeding the IF me.newrecord... is not ideal. Some of that is partly my fault since I didn't realize the large number of controls on your form. Basically all of the code has to be embedded within the IF me.newrecord THEN..ELSE....END IF. All of the code that currently resides outside of the IF me.newrecord THEN...ELSE...END IF statement must be copied to the section between the ELSE and END IF
IF me.newrecord THEN
statments to make all controls visible
ELSE
statements that make controls visible or not when the current record is an existing record and certain values have been selected in the associated combo boxes
END IF
I have removed all the "New Record" Codes and everything I want it to do works without these. Are they absolutely necessary?
If you remove the IF me.newrecord.., some of the controls may remain hidden if you hid them using the on current event.
Okedoke. How do I construct them into the on current event.
i.e at the moment it looks like this:
Code:Private Sub Form_Current() If Me.cboEntranceDoorsFlats = "None" Then Me.txtEntranceDoorsFlatsQuant.Visible = False Me.txtEntranceDoorsFlatsRenewYear.Visible = False Else Me.txtEntranceDoorsFlatsQuant.Visible = True Me.txtEntranceDoorsFlatsRenewYear.Visible = True End If (...More If's) End Sub
The basic structure would look like this
Code:Private Sub Form_Current() IF me.newrecord THEN me.controlname.visible=True (one for each control that you want visible when a new record is to be added; if you want all you could set up a loop to do that but that might complicate matters at this point) ELSE If Me.cboEntranceDoorsFlats = "None" Then Me.txtEntranceDoorsFlatsQuant.Visible = False Me.txtEntranceDoorsFlatsRenewYear.Visible = False Else Me.txtEntranceDoorsFlatsQuant.Visible = True Me.txtEntranceDoorsFlatsRenewYear.Visible = True End If (...More If's) END IF End Sub
Thanks for this!
Yep loops... erm... lets leave that one for now lol!