Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3
This is the forum to discuss the Wrox book Access 2007 VBA Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Armen Stein; ISBN: 9780470047033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 2nd, 2009, 02:57 PM
Authorized User
Join Date: Dec 2004
Location: , , .
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default "Out of Memory" When I'm clearly not


I'm an experience Excel VBA coder venturing into the Access unknown. For anyone familar with the Bloomberg COM V3 API, I'm attempting to marry that to our Portfolio Management Access Database. Here's my problem:

As I'm stepping through the return data from Bloomberg and inserting it into my table, after 5 fields it gives me an "Run-time error '7': Out of memory". MSACCESS is not using any additional memory, and the task manager performance windows don't show any spike in activity. This same code works just fine inserting the same data into an excel worksheet.

Anyone have any ideas? I am the only user of this data. Thanks.

Private Sub session_ProcessEvent(ByVal obj As Object)
    On Error GoTo errHandler
    Dim eventObj As blpapicomLib.Event
    Dim dbs As DAO.Database
    Dim rstbl1 As DAO.Recordset
    Dim rstbl2 As DAO.Recordset
    Set eventObj = obj
    Set dbs = CurrentDb
    Set rstbl1 = dbs.OpenRecordset(wrktbl1, dbOpenTable)
    Set rstbl2 = dbs.OpenRecordset(wrktbl1 & " BH", dbOpenTable)
    'If  Then
        If eventObj.EventType = PARTIAL_RESPONSE Or eventObj.EventType = RESPONSE Then
            Dim it As blpapicomLib.MessageIterator
            Set it = eventObj.CreateMessageIterator()
            Do While it.Next()
                Dim msg As Message
                Set msg = it.Message
                Dim numSecurities As Integer
                numSecurities = msg.GetElement("securityData").NumValues
                Dim i As Integer
                rstbl1.Index = "PrimaryKey"
                For i = 0 To numSecurities - 1
                    Dim Security As Element
                    Set Security = msg.GetElement("securityData").GetValue(i)
                    rstbl1.Seek "=", Left(Security.GetElement("security").Value, 9)
                    Dim fields As Element
                    Set fields = Security.GetElement("fieldData")
                    Dim a As Integer
                    Dim numFields As Integer
                    numFields = fields.NumElements
                    If Not rstbl1.NoMatch Then
                      For a = 0 To numFields - 1
                        'If IsNull(rstbl1) Then
                          Set rstbl1 = dbs.OpenRecordset(wrktbl1, dbOpenTable)
                          rstbl1.Index = "PrimaryKey"
                          rstbl1.Seek "=", Left(Security.GetElement("security").Value, 9)
                        'End If
                        Dim field As Element
                        Set field = fields.GetElement(a)
                        X = 1
                        found = False
                        Do Until found
                          If StrComp(field.Name, rstbl2.fields(X).Value, vbTextCompare) = 0 Then
                            found = True
                            X = X + 1
                          End If
                        rstbl1.fields(X).Value = field.Value  <-- Error occurs here.
                        Set rstbl1 = Nothing
                    End If
        End If
    'End If
    Exit Sub
    Dim errmsg As Variant
    errmsg = Err.Description
    MsgBox errmsg
    Set eventObj = Nothing
    Set dbs = Nothing
    Set rstbl1 = Nothing
    Set rstbl2 = Nothing
End Sub
I should mention that I tried to minimze the un-updated data by clearing out the object after each field update. Trying to do it all at once (updating each field before running the .update) ends with the same error after 5 field updates.
Reply With Quote
The Following User Says Thank You to Ahrenl For This Useful Post:
j0el (April 14th, 2010)
  #2 (permalink)  
Old April 14th, 2010, 03:04 AM
Registered User
Join Date: Apr 2010
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default Database validation

Hello Ahrenl,

Just let you know I am Joel. is that the codes for DH database validation?!

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulties with "web.config" and "ASPNETDB" CFRham BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 2 July 3rd, 2010 10:19 AM
Need code corrections "get sub or function not defined" error" bluesboytoo Excel VBA 1 October 22nd, 2009 11:12 PM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM

All times are GMT -4. The time now is 02:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.