Results 1 to 4 of 4
  1. #1
    SltPhx is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    41

    Question Setting a value to a control in a subform

    Hello All,
    I am trying to set a value to a control in my subform (On Load) but it is not working.
    FRM_ASQ has a button upon clicking open a FRM_Planchange_Input which has a subform FRM_PlanChange_Input_Details.
    On Load - I assign values to controls in the FRM_Planchange_Input and I am trying to assign values to control in the subform FRM_PlanChange_Input_Details.

    On Load,
    SetPropery -
    Control Name: [Forms]![FRM_Planchange_Input]![FRM_PlanChange_Input_Details].[Form]![ASQ]
    Property: Value
    Value: =[Forms]![FRM_ASQ]![ASQ #]

    I am copying the data in Form ASQ to Subform Plan Change Details.
    Whenever the macro is run, it gets stuck at the point giving an error "The control name is misspelled or refers to a control that doesn't exist. If the invalid control name is in macro, an Action Failed dialog box will display the macro name and the macro's arguments after you click OK."
    Upon clicking OK, i get Error Number 3021 - Arguments [Forms]![FRM_Planchange_Input]![FRM_PlanChange_Input_Details].[Form]![ASQ]

    The syntax I used is based on this article: Forms![main form name]![subform control name].Form![control name]. I also read that Subform Control Name and Subform Name are not the same??
    I am getting confused. Please help me asap. Spend hours reading articles and trying various macros events.



    Thank you.

  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,772
    If code is behind main form then must reference subform through the subform container control. I always name subform container control different from the object it holds, like: ctrDetails. I don't use macros, only VBA. So VBA would be like:

    Me.ctrDetails!fieldname

    or

    Me.ctrDetails.Form.textboxname


    SetProperty is misspelled in your post.


    Why are you copying data?
    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
    SltPhx is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    41
    Thanks June. I am not sure what a "subform container control" is.
    I am not very familiar with VBA, Macros seem easier. Also, In the first form - some search details are displayed, upon opening another form - additonal details regarding the ASQ details are added (Plan Change Details). So some data from the ASQ form is "copied" over to the Plan Change Details so the user does not have to enter it twice.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Subform (and subreport) is created by putting a subform/subreport container control on another form/report then setting subform/subreport container control SourceObject property to a table, query, form, or report.

    Sorry, still don't understand why data is duplicated. Duplication of data is contrary to basic relational database principles.
    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.

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

Similar Threads

  1. Replies: 8
    Last Post: 06-19-2015, 02:19 AM
  2. Replies: 6
    Last Post: 09-17-2014, 01:04 PM
  3. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  4. Setting a Color on a Control For Error
    By AccessLes in forum Programming
    Replies: 6
    Last Post: 06-16-2010, 12:35 PM
  5. syntax on setting image Picture control
    By cowboy in forum Reports
    Replies: 2
    Last Post: 02-18-2010, 10:00 AM

Tags for this Thread

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