Results 1 to 4 of 4
  1. #1
    Join Date
    May 2005
    Posts
    28

    Question Unanswered: Out of Memory when .Edit Recordset

    The following code produces an out of memory when a = 5. (The lines that are commented out cause the memory error)

    Any Ideas?

    Code:
                    
                  For a = 0 To numFields - 1
                      Set field = fields.GetElement(a)
                      If InStr(1, field.Value, "#", vbTextCompare) = 0 Then
                        rstbl1.Edit
                        x = 0
                        found = False
                        Do Until found Or x >= rstbl2.fields.Count
                          If StrComp(rstbl2.fields(x).Value, field.Name, vbTextCompare) = 0 Then
                            found = True
                          Else
                            x = x + 1
                          End If
                        Loop
                        
                        If found Then
                          If InStr(1, rstbl2.fields(x).Value, "GEO", vbTextCompare) > 0 Then
                            If InStr(1, field.Value, " ", vbTextCompare) > 0 Then
                               'rstbl1.fields(x).Value = Trim(Left(field.Value, InStr(1, field.Value, " ", vbTextCompare) - 1))
                               'rstbl1.fields(x + 1).Value = CDbl(Replace(Trim(Right(field.Value, Len(field) - InStr(1, field.Value, " ", vbTextCompare))), "%", "")) / 100
                            End If
                            x = x + 1
                          Else
                            'rstbl1.fields(rstbl2.fields(x).Name).Value = field.Value                      End If
                          rstbl1.Update
                        End If
                      End If
                    Next

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I might try pushing recordset values into variables and then utilize those variables to populate other fields.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    May 2005
    Posts
    28
    The variable idea didn't work, but I appreciate the brainstorm.

    What I've found is that the value returned, although it looks like a number, gives a FALSE return for an IsNumeric() call. So I need to figure out if a field is supposed to receive a Fieldsize of Double, and then run a CDbl() on the data. I haven't located the object to check fieldsize yet, as in the object list .fieldsize value = <Invalid field data type>. Whatever that means...

  4. #4
    Join Date
    May 2005
    Posts
    28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •