Solved

append not working in linked table

Posted on 2013-01-29
7
218 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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 …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now