Results 1 to 7 of 7
  1. #1
    tndinnc is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    11

    Question Unbound Form and Editable Subform

    I need help in figuring out how to accomplish this in access 2010 or 2007

    I have an unbound form with a text box on it. The text box is "Order Number". When someone enters an order number and clicks "search" I need to populate a subform or grid or something with the existing details of what products were on the that order. Users will need to then input the extra information and save all of the information to a table. My problem is when I populate the subform with query results it's not editable. All my tables are in SQL server. I'm familiar with VBA - is there a way to populate this subform with the results of a stored procedure maybe without actually binding it to anything?

    Ref # Product Name Product ID Gross Net Supplier Delivery Date
    111 product 1 prod1
    2222 product 2 prod2



    Thanks to anyone who can point me in the right direction or give a comment to help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Why not bound form?

    How are you populating the subform - show code.
    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
    tndinnc is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    11
    The reason I was shying away from a bound form for the main form is because the order table has 100000s of records in it and I thought it would be better performance to not have that form open up with all those records in there. I am not currently populating the subform as my question is "how" to populate it I have no code to show.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    The form could probably be bound but set to open filtered with criteria that results in empty recordset. Then use code behind the form to requery form based on textbox value.

    Options:

    1. parameterized query as the form RecordSource, parameter would be reference to the unbound textbox, since the form opens with nothing in the box, the form will filter so no record retrieved, code in textbox AfterUpdate event Me.Requery would retrieve the record matching the input

    2. set the Filter and FilterOn properties of form to filter to an non-existent ID, code in textbox AfterUpdate would reset the Filter property to input value

    Set the Master/Child links properties of the subform container and the records will synchronize.

    That leaves the question of why the subform records are not editable.

    Your post stated 'when I populate the subform with query results it's not editable' - how does this population happen? Did you mean when the subform is bound to a query? Post the SQL statement of the subform RecordSource.
    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.

  5. #5
    tndinnc is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    11
    Here is the sql for my subform query. I want to populate VPSBOL table. But if there is already something in there matching my order number I want to show it so they can edit it. SELECT dbo_freightdetail.fgt_refnum, dbo_freightdetail.cmd_code, dbo_stops.cmp_id, dbo_orderheader.ord_number
    FROM dbo_VPSBOL RIGHT JOIN ((dbo_freightdetail INNER JOIN dbo_stops ON dbo_freightdetail.stp_number = dbo_stops.stp_number) INNER JOIN dbo_orderheader ON dbo_stops.ord_hdrnumber = dbo_orderheader.ord_hdrnumber) ON dbo_VPSBOL.LoadPay = dbo_orderheader.ord_number
    WHERE (((dbo_orderheader.ord_number)="1235799") AND ((dbo_stops.stp_type)="drp"));

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    A form can do data entry/edit to only one table. I see 4 datasets in that sql:
    dbo_freightdetail
    dbo_stops
    dbo_orderheader
    dbo_VPSBOL

    No fields are pulled from dbo_VPSBOL. How can you enter/edit data of VPSBOL if fields are not pulled?

    What are the relationships of these tables?

    If you want to provide db for analysis, follow instructions at bottom of my post (make copy, import relevant tables).
    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.

  7. #7
    tndinnc is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    11
    my apologies I removed the fields from VPSBOL as I have been working on it and did not readd them before sending. I am aware I can't edit/save without them and that you can only update/save to one table. However it takes all 4 tables in that one query to pull the information I want to show.

    FreightDetail joins Stops on Stop#
    Stops joins OrderHeader on OrderHeaderNumber

    That will give me the original order information

    then I added
    OrderHeader joins VPSBOL on OrderNumber

    to get any previously entered extra information.

    I know I can't edit the data using that query as the source. but what I want to know is how to show that information on the form, and just update the VPSBOL fields if I click save.

    I will clean up my db and attach. thanks.

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

Similar Threads

  1. Replies: 5
    Last Post: 06-23-2012, 10:30 PM
  2. Replies: 18
    Last Post: 04-22-2012, 11:39 AM
  3. Replies: 1
    Last Post: 04-18-2012, 07:38 AM
  4. Updatable & editable subform?
    By jfn15 in forum Forms
    Replies: 2
    Last Post: 06-21-2011, 10:35 AM
  5. Replies: 0
    Last Post: 05-09-2010, 08:43 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