Newbee1000
MIS
I have linked tables from a SQL server in a MS ACCESS.This SQL server is on a netwrok drive MS ACCess is on my local PC on the network. Every time I try to run a report or query I am asked to enter in my username and password. I want to automate that or enter it only once and not have to enter the authentication everytime.
I try to write a function as below:
"
Public Function Begin()
On Error GoTo Begin_Err
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim sConnString As String
cn.Open "DSN=PORTAL;" & _
"Uid=DBReview;" & _
"Pwd=take@h1ke"
Set cmd.ActiveConnection = cn
Begin_Exit:
Exit Function
Begin_Err:
MsgBox Error$
Resume Begin_Exit
End Function
"
and then want to run it from a Macro.But when I try to run it from a Macro it gives me an error that the function name entered is not found.
Please help.
I try to write a function as below:
"
Public Function Begin()
On Error GoTo Begin_Err
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim sConnString As String
cn.Open "DSN=PORTAL;" & _
"Uid=DBReview;" & _
"Pwd=take@h1ke"
Set cmd.ActiveConnection = cn
Begin_Exit:
Exit Function
Begin_Err:
MsgBox Error$
Resume Begin_Exit
End Function
"
and then want to run it from a Macro.But when I try to run it from a Macro it gives me an error that the function name entered is not found.
Please help.