Results 1 to 4 of 4
  1. #1
    selvakumar.arc is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    49

    Record Navigation which throwing an error in sub form control

    Hi,


    I have a user input page in my application which consist of few text box and a sub-form. In main form I have "Save and Next" button, once the user enter this button will save the current record in database and ready for next user input. The problem here is I am unable to access the sub-form control after saving the records. I have attached the code here.

    Private Sub SaveNext_Click()
    Me.Refresh
    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
    End Sub
    Private Sub Form_Close() 'trying to unhide the sub form control, throwing error
    Me.AnswerOptions.Form![AnswerOptionCodes].ColumnHidden = False '//Here I am getting an error Run-time error 2455. You entered an expression that has an invalid reference to the property Form/Report.
    End Sub
    Private Sub Form_Load() 'trying to hide sub for control, working fine
    Me.AnswerOptions.Form![AnswerOptionCodes].ColumnHidden = True
    End Sub

    Regards,
    Selvakumar R

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    You want to unhide a column in the subform before closing the form? The issue may be the subform is already closed and unavailable. Try code in the subform Unload event.

    Why do you bother unhiding that column when you automatically hide it in Load event?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    selvakumar.arc is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    49
    User wants to enter information continuously, so implemented "save and next" in this page and this is working as expected. But only issue is the run-time error in unhiding the controls in the sub form. And my form contains a list of text box and a sub form, like one to many relationship (pls consider a student related to different department).

    Based on page functionality I want to hide only one control during the form load which is not relevant to that page and unhide it in closing the form, because the same sub form is using in another page.

    This is continuous input form and allows user to enter data continuously without closing the form.

    As per your comments I will write code in unload event and let you know the updates.

  4. #4
    selvakumar.arc is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    49
    Hi June7,
    I written unhiding code in form unload event and it is working. Thanks alot for your help...

    Regards,
    Selvakumar R

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 11-22-2012, 08:03 AM
  2. Replies: 13
    Last Post: 10-19-2012, 06:34 AM
  3. Opening a Form within Navigation Control
    By karla.uptown@gmail.com in forum Access
    Replies: 5
    Last Post: 10-08-2012, 10:55 AM
  4. Navigation Control - go to new record
    By SamNotSoWise in forum Forms
    Replies: 1
    Last Post: 06-26-2012, 02:57 PM
  5. Navigation Form control syntax 2010
    By AndycompanyZ in forum Forms
    Replies: 2
    Last Post: 06-28-2011, 07:23 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