Results 1 to 2 of 2
  1. #1
    jhargram is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012
    Posts
    40

    Not able to save Listview data on a access table

    Hi All,

    I have some issue when i save list view data in a access table.
    In form I have a list box(listtotalcount) and one text box(ID). In form load event I run a query on that list box like: "SELECT count(id) FROM table A" and it gave me the correct result. Now I want to store this data on a different table (table b) and I use this code:

    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Set db = CurrentDb
    Set rst = db.OpenRecordset("table b", dbOpenDynaset)
    With rst
    .AddNew
    !id=txtid
    !LineCount = listtotalcount


    .Update
    End With


    But the problem is when I click the save button it store only id not the list box value. Can anyone update me the solution. Thanks in advance..

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Not saved because the listbox row needs to be selected to set the listbox value.

    Use a textbox with DCount() expression in ControlSource: DCount("ID", "[Table A]").

    Why would you store the count of all records in a table and associate to one ID?

    Why even save record count? Surely this can be calculated whenever needed?
    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: 11
    Last Post: 07-24-2012, 07:50 PM
  2. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  3. Listview pulling data from a second table
    By Yesideez in forum Access
    Replies: 8
    Last Post: 06-29-2011, 05:08 AM
  4. Replies: 4
    Last Post: 01-05-2011, 07:56 AM
  5. Transfer data from ListView to Table
    By Zyckie in forum Access
    Replies: 1
    Last Post: 12-15-2009, 11:23 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