Solved

append not working in linked table

Posted on 2013-01-29
7
252 Views
Last Modified: 2013-01-30
After testing with a local mdb table I imported this table to sql server 2005 and linked it in access.

Now it doesn't seem to want to do the insert. What is wrong with the code below?

  Dim db As DAO.Database
    Dim RcdSet As DAO.Recordset
    
    Dim sqlErrors As String
    Set db = CurrentDb()
    sqlErrors = "Select * From tblErrorLog"
    Set RcdSet = db.OpenRecordset(sqlErrors, dbOpenDynaset)

    With RcdSet
    
        .AddNew
            !ErrorNumber = ErrEx.Number
            !ErrorDescription = ErrEx.Description
            !HostUserID = gintHostUserID
            
            ErrEx.Callstack.FirstLevel
            
            Do
                !CallStackInfo = !CallStackInfo & _
                                    ErrEx.Callstack.ProjectName & "." & _
                                    ErrEx.Callstack.ModuleName & "." & _
                                    ErrEx.Callstack.ProcedureName & ", " & _
                                    "#" & ErrEx.Callstack.LineNumber & ", " & _
                                    ErrEx.Callstack.LineCode & vbCrLf & _
                                    ErrEx.Callstack.VariablesInspector.DumpAll & vbCrLf
            Loop While ErrEx.Callstack.NextLevel
            
        .Update
        
        .Close
        
    End With
    
    Set RcdSet = Nothing

Open in new window

0
Comment
Question by:Shawn
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38833441
What is going wrong ?
Do you get an error message or what?


And what does this mean?
 ErrEx.Callstack.FirstLevel

it's not any vba I've ever seen.
0
 
LVL 1

Author Comment

by:Shawn
ID: 38833451
>> Do you get an error message or what?

no message at all. just no insert

>>ErrEx.Callstack.FirstLevel

it's from a product called vbWatchDog. amazing
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38833485
Does tblErrorLog have a Primary Key?  It might also need a timestamp field.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Author Comment

by:Shawn
ID: 38833491
yes, it has a primary key.

I'm thinking there is a typo somewhere in the code but have been staring at it too long.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 38834363
You may need this:

Set RcdSet = db.OpenRecordset(sqlErrors, dbOpenDynaset, dbSeeChanges)

and, as noted, a Timestamp field.

Also, do open the linked table manually and try to add a record with data as the code would do.

/gustav
0
 
LVL 1

Author Closing Comment

by:Shawn
ID: 38837249
thanks Gustav. Was missing the dbSeeChanges.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 38838496
You are welcome!

/gustav
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question