Results 1 to 4 of 4
  1. #1
    eskybel is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    74

    Dlookup, and direct table edits

    I have a form, and a subform (frmTrans, and sformTrans). frmTrans is unbound, using dlookup in the txtITEMID text box for displaying information to the user about that item. Ex: user scans barcode, and the form dlookup for that ITEMID, displays type, make, model, user, location, etc. This works fine.



    sformTrans is currently bound to a table (tblTrans) that holds all the transactions against all ITEMIDs. Ex: this monitor moves from here to there, or that PC was discarded, and this table holds the records on these moves for historical purposes.

    I have the main form in single form view. I have the subform in datasheet view. I want to be able to scan (or enter) a number in the ITEMID field in the main form, and have it filter the subform based on the transactions of that ITEMID, but to allow me to enter information into that table directly in the subform, based on that ITEMID.

    I looked at the filter property on the subform, trying to point it to the txtITEMID field above, but this didn't seem to work. I also tried to force a "requery" as part of the dlookup process. Couldn't get this right either.

    I then thought, binding the subform to a temp table, having the user enter in the transaction information, then using an append/clear query to the main table. This may be fine, but wanted to see if I could make the above work, because then a user can see the historical information while entering the new transaction at the same time, deal with less queries and tables. Probably not best practice to edit the table directly each time...

    I'm sure this is a lot easier than I'm making it out to be, but I can't seem to find what I want to do.

  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,771
    Temp table not needed and poor design.

    If the main form is unbound, I would not use form/subform. Suggest a single form in Continuous view with unbound combobox to select ITEMID in the form header section. Controls in continuous form can be arranged to look like datasheet.

    Also don't see need for DLookup. Code in the combobox AfterUpdate event like:

    Me.Filter = "ItemID=" & Me.comboboxname
    Me.FilterOn = True
    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
    eskybel is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    74
    My apologies, I misstated my first line. My frmTrans (main form) is bound to my tblInventory table. The dlookup is used to retrieve inventory information for display. The subform is bound to tblTrans, for putting transactions against that item. Since there are two separate tables holding different information, I assume there isn't an easy way to have one form in continuous view.

  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,771
    Main form must be in single view, the subform can be in single, continuous, datasheet (don't know about pivot).

    If ItemID is the primary/foreign key that records are related by, code is not needed. Set the Master/Child links properties of the subform container control and the records will automatically synchronize.
    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: 4
    Last Post: 01-05-2013, 02:43 AM
  2. Replies: 2
    Last Post: 12-22-2010, 01:46 PM
  3. Replies: 3
    Last Post: 10-04-2010, 07:29 AM
  4. [Resolved] Direct Link to Access Form?
    By objNoob in forum Forms
    Replies: 1
    Last Post: 03-16-2010, 12:06 PM
  5. how to play mp3 direct from database
    By sean in forum Access
    Replies: 0
    Last Post: 10-20-2009, 08:27 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