Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    Yes, the data already exists...so I will try the Sub routine as you suggested alcapps. Here I thought normalizing the data was a good thing...but I think it has caused more headaches for me.

  2. #17
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    Thanks first time I've run into that.

  3. #18
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    When running Debug I get a Compile error:
    User-defined type not defined

    and it highlights... db As DAO.Database

  4. #19
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    You must have Microsoft ado 3.6 object library loaded in references which you find in Vba tools

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You are running this code in Access 2003? DAO is the default recordset library in Access so the code should work. But see what happens when selecting the ADO library in VBA: Tools>References>Microsoft ActiveX Data Objects 2.x Library

    However, I don't think you need the db variable, especially since it is referenced only once.

    Try using the New qualifier in declaring the recordset variable. Does table name have spaces or special characters? To be safe, include [] in the code. Same would apply to field names.

    Dim rst As New DAO.Recordset
    strSQL = "Select * from [" & datTableName & "] where num is NULL order by ID, inkmark"
    Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
    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.

  6. #21
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    I am running ACCESS 2010

  7. #22
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My last post comments still apply to 2010.
    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.

  8. #23
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    Sorry for my ignorance, but do I call this from a form?

  9. #24
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Call what - the procedure? Yes, if you want to. Create a button and put code in the click event.

    Alternatively, if this is a one-time event, just put the code in a general module. Position cursor anywhere in the procedure and click Run from the VBA tool bar.
    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.

  10. #25
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    I tried run it while in the code and it pops up a macro window

  11. #26
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The procedure must be in a general module, not behind a form.

    How many records are involved in this exercise?
    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.

  12. #27
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    There are 1417 records

  13. #28
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So a few too many for a manual edit.

    Is the code in a general module?
    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.

  14. #29
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    Yes; under (General); and under Modules

  15. #30
    bdhFS is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2010
    Posts
    32
    This is actually something I need to do with data often. Most of the data post processing is done in SAS or GIS which needs a flat file.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 12-04-2012, 02:46 AM
  2. Use VBA to edit record or create new record in a query
    By ryantam626 in forum Programming
    Replies: 11
    Last Post: 08-09-2012, 02:37 AM
  3. Replies: 2
    Last Post: 06-06-2012, 09:35 AM
  4. Replies: 1
    Last Post: 03-08-2012, 09:17 AM
  5. Report Restarts Itself And Never Completes
    By VariableZ in forum Reports
    Replies: 10
    Last Post: 03-01-2012, 10:47 PM

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