
Originally Posted by
Demon
I put the code when I load the form, is that ok?
Private Sub Form_Load()
Dim adoConn As New ADODB.Connection
Dim adoRS As New ADODB.Recordset
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "E:\EasyHID\Xk1 v2\USBProject\VisualBASIC\Modified code\NR2003.mdb"
adoConn.ConnectionString = strConn
adoConn.Open
End Sub
Or should I make another subroutine for this?
Robert

Thats exactly where I put it !
Code:
Private Sub Form_Load()
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "K:\HTML\db\KAT5AV.mdb"
adoConn.ConnectionString = strConn
adoConn.Open
MSComm1.CommPort = 3
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
End Sub
Having said that, the one big difference I see is that you declare your adoConn and adoRS within the subroutine therefore they are not global variables and once you leave Form_Load they arent accessable.
Mine are declared in General Declarations.
Last edited by Demon; - 4th October 2016 at 16:57.
Keith
www.diyha.co.uk
www.kat5.tv
Bookmarks