Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Quote Originally Posted by jzwp11 View Post
    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
    Thanks for reply.


    I have removed all the "New Record" Codes and everything I want it to do works without these. Are they absolutely necessary?

  2. #17
    jzwp11 is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    If you remove the IF me.newrecord.., some of the controls may remain hidden if you hid them using the on current event.

  3. #18
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Quote Originally Posted by jzwp11 View Post
    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

  4. #19
    jzwp11 is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    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

  5. #20
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152
    Thanks for this!
    Yep loops... erm... lets leave that one for now lol!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-06-2011, 04:38 AM
  2. Report showing non-visible fields
    By AKQTS in forum Forms
    Replies: 2
    Last Post: 09-21-2010, 09:40 AM
  3. Setting fields visible/invisible
    By col5473 in forum Forms
    Replies: 1
    Last Post: 09-17-2010, 09:14 AM
  4. Cannot hide fields in a datasheet
    By desgordon in forum Forms
    Replies: 2
    Last Post: 08-19-2009, 03:24 PM
  5. how to hide the fields in subform
    By tinytree in forum Forms
    Replies: 3
    Last Post: 05-01-2009, 07:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums