?
Solved

append not working in linked table

Posted on 2013-01-29
7
Medium Priority
?
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 48

Expert Comment

by:Dale Fye
ID: 38833485
Does tblErrorLog have a Primary Key?  It might also need a timestamp field.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 51

Accepted Solution

by:
Gustav Brock earned 2000 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 51

Expert Comment

by:Gustav Brock
ID: 38838496
You are welcome!

/gustav
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 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