troubleshooting Question

verify record size in database using RDO

Avatar of loco337
loco337 asked on
Visual Basic Classic
6 Comments3 Solutions181 ViewsLast Modified:
I am getting the record size using rdo in the following way..

intFieldSize = rdoConnect.rdoTables(tblName).rdoColumns.Item(i).Size

I am passing the size value to the function below to ensure that the element I want to insert into the database does not exceed the record size. However, many records are being prompted that they are too big, but they are still being inserted into the database? Am I doing something wrong? Is there a better way of doing this?

Thanks..

Public Function cmdTrimLength(strString As Variant, intSize As Long, intType As Integer) As String
Dim intTestStringLen As Integer
Dim intInteger As Integer

Trim (strString)

Select Case intType

Case intType = -6 Or intType = -2

   intInteger = CInt(strString)
   If Len(intInteger) > 1 Then
      strString = Left$(strString, 1) '  SubString does not exceed recordLength
      MsgBox "Field length too large!", vbCritical
   End If
   
Case Else

   If Len(strString) - 2 > intSize Then
      strString = Left$(strString, intSize)
      MsgBox "RECORD LENGTH WAS TOO BIG!", vbCritical
   End If
   
End Select
   cmdTrimLength = strString
End Function
ASKER CERTIFIED SOLUTION
CD-Softy

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros