Friday, March 30, 2012

Runtime error 3704

Hi,

I've created an application that runs on several pc's. However, on one particular pc, when I run the following code to test the connection to the SQL server, it generates the error "Runtime error '3704'" and it happens only when it hits the Form1.Users.Movefirst section.

I've checked all the user permissions on the server and dont seem to find any difference there.

code:-

Option Explicit
Public Db As New ADODB.Connection
Public Users As New ADODB.Recordset

Private Sub Command1_Click()

If Not Form1.Users.BOF Then
Form1.Users.MoveFirst
End If

With Form1.Users
Do While Not Form1.Users.EOF
Debug.Print Form1.Users.Fields(0)
Form1.Users.MoveNext
Loop
End With

End Sub

Private Sub Form_Load()

On Error Resume Next
Set Db = Nothing

Db.Open _
"Provider=SQLOLEDB.1;Server=File;" & _
"Database=Cash Management;Trusted_Connection=Yes"

'Open the recordsets
With Form1.Users
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.ActiveConnection = Form1.Db
.Source = "Select * from Users order by userid"
.Open "SET NOCOUNT ON"
End With

End Sub

ThanksIt is very simple. You are running "SET NOCOUNT ON" only. What MDAC version do you use?|||Hi.. Thanks for your reply. Normally, my .open has nothing after it. Only after I searched on the net, did I add that "Set NoCount On", but it didn't help. Sorry to sound ignorant, but how do I tell what ver of MDAC I'm using ?

Carl|||Q1. What MDAC version am I using?
A1. Use regedit.exe, see branch "HKEY_LOCAL_MACHINE\Software\Microsoft\DataAccess" node "FullInstallVer"|||It looks like 2.70.7713.4.

Tks..|||You added "SET NOCOUNT ON" for test purposses only, remove it.
In your code, after the part where you try to open a connection,
add a check (+msgbox) to know if it is really connected.
It can be a domain security problem.|||Ok - I checked the registry on the pc that I was installing on and I see the version of MDAC is 2.53.6200.1. This is the same as another pc that is working.

If this is not the problem, I suspect that it is a permissions problem, but I have no idea where to check as this user has been registered exactly the same as the other users that work.

Thanks|||Run (for W9x)
command /K net config
from Start->Run commandline on the client machine and you will see his logon info (or ask him to do it and send results).|||My email address is alkemac@.hotmail.com. Can you please send an email and I will reply with screen shots of the different screens, including the SQL Svr user registration screen ?

Thanks|||It was a user default database problem. The user solved it by himself.|||What do you mean by "default database problem"? Can you explain how the user solved it himself? We have a similar problem with a VB application that opens an Access database. It runs on most computers, but not some. One gets the 3704 runtime error. Thanks.sql

No comments:

Post a Comment