Home > Software engineering >  VB access database problems calling through the module.
VB access database problems calling through the module.

Time:10-02

I dishes ah, is really can not find a way to turn,
The following is the code in the module, why can't I login window call? The total error,
The Public Function ExeSQL (ByVal Sql As String) As the ADODB library you
On Error GoTo ErrHandler:
Dim Connstr As String
Dim CN As ADODB. Connection
Dim the rs As the ADODB library you
Dim strArray () As String
Dim DataPath As String

Set the CN=New ADODB. Connection
Set the rs=New ADODB. You

DataPath="PC281453 \ Users \ Data \ Data. The MDB"
Connstr="Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source="+ DataPath +"; Persist Security Info=False "
StrArray=Split (Sql)
CN. Open Connstr


Why Data Source="& amp; App. The Path & amp; Can, the problem is food, but not to the purpose,

CodePudding user response:

Put in DataPath from drive the full path to try, in addition, string concatenation operator is best & amp; Instead, +.

CodePudding user response:

If your database is in the exe folder, might as well

DataPath=App. Path & amp; "\ Data. MDB"

If you are quoting is exe folder where a folder path, can

DataPath=App. Path & amp; "\ PC281453 \ Users \ Data \ Data. The MDB"

CodePudding user response:

refer to the second floor of123 response:
if your database is in the exe folder, might as well

DataPath=App. Path & amp; "\ Data. MDB"

If you are quoting is exe folder where a folder path, can

DataPath=App. Path & amp; "\ PC281453 \ Users \ Data \ Data. The MDB"


I put the database in local area network (LAN) in the Shared folder,
At first, the database is in the exe folder where
Use DataPath=App. The Path should be no problem,
After using this path \ PC281453 \ Users \ "Data \ Data. The MDB" began to report errors,
  • Related