• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

ADO control refresh error 2147467259

Hi,

Can anybody help?  I have a VB6 program with Access 97 database.  One screen has a number of ado controls.  I use a couple of routines to set the properties of the ado controls when the screen loads up.  The screen opens up fine the first few times but then it fails with the error 2147467259 Unspecified error.  The line of code it is stopping on is the ado control refresh.  It's not always the same control it fails on.  Here is the code:

Private Sub set_ADO(ByVal sql As String, ByVal ctl As Control)
ctl.ConnectionString = sConstr
ctl.CommandType = adCmdText
ctl.RecordSource = sql
ctl.CursorType = adOpenKeyset
ctl.LockType = adLockPessimistic
ctl.CommandTimeout = 30
ctl.Refresh
End Sub

Thanks
0
tattie
Asked:
tattie
  • 2
1 Solution
 
TomLaw1999Commented:
You will probably find that  the error code is -2147467259 (note the minus sign) and it often seems to pop up when you have a data entry error. This can be caused by:

1) A duplicated index (where duplicates are not allowed)
2) A Missing or corrupted data file
3) Probably one or two other things that I hav'nt come accross yet.

I suggest that you catch the error then check the specific record that is causing the problem. It may be that you need to prevent users from entering inappropriate information into fields, i.e. text into a numeric field or over long text fields (or duplicate index fields).
0
 
CleanupPingCommented:
tattie:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
TomLaw1999Commented:
tattie - You posted a grade 'C'. Were you unhappy with my answer ?.
0
 
tattieAuthor Commented:
TomLaw99 - No, I wasn't unhappy with your answer but in the end I found the cause of the problem was neither of the first 2 points in your email, although I'm sure they are also potential causes.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now