Ok here is some background. We have a remote office, connected to a DSL connection. We use a VPN to connect the remote office to our office to form a WAN. We have also got a visual foxpro database in the main office which we wish to connect with using ODBC.
This application queries the database and retrieves information from it. No updating or deleting.
'this function accepts the short job name, and extract the names of client, job,
'and the folder where all files concerning the job is located
'set of parameters and variables
Dim dbw As Workspace 'workspace containing connection
Dim con_string As String 'string used for creating new connection to database
Dim docmngc As Connection 'object used as pointer to database connection
Dim msg As String
Dim qs As String 'string used for querrying database
Dim rs As Recordset
Dim flag As Boolean
Dim myclientcode As String
Dim mydiskloc As String
'create a new workspace and include it in the workspace array
Set dbw = CreateWorkspace("manager", "admin", "", dbUseODBC)
'open new connection to database from client machine, on error divert to "connerror"
On Error GoTo connerror
Set docmngc = dbw.OpenConnection("anything", dbDriverNoPrompt, False, con_string)
'set query string to get client name and job name details
qs = "SELECT shortjobno, clientcode, projectname, name as client_name FROM project " _
& "INNER JOIN client ON project.clientcode = client.code WHERE shortjobno='" _
& jobnumber.Text & "'"
'send query and receive query result as recordset object
Set rs = docmngc.OpenRecordset(qs)
flag = False
Do Until (rs.EOF Or flag = True)
If (rs!shortjobno = jobnumber.Text) Then
client_name.Text = rs!client_name
job_name.Text = rs!projectname
myclientcode = rs!clientcode
flag = True
msg = "I had a problem. Error Message: " & Error()
If Err.Number = 3146 Then
msg = msg & vbCrLf & "I cant seem to connect to the jobfile Database"