Good day to all,
I have this attached picture "paths.jpg"
the purpose of this paths is for easy linking procedure. the form is a countinous form which has only three fields: pathnameid,pathname,pathlocation
And I have this code:
'-------------------------------------------------
Private Sub attach_Click()
Dim wrk As Workspace
Dim dbBack As Database
Dim strTable As String
Dim strFileName As String
Set wrkDefault = DBEngine.Workspaces(0)
strFileName = DLookup("pathlocation", "path", "pathnameid = 1")
Set dbBack = wrkDefault.OpenDatabase(strFileName, False, False, "MS Access;PWD=""")
DoCmd.TransferDatabase acLink, "Microsoft Access", dbBack.Name, acTable, "companybranch", "companybranch", False, True
DoCmd.close acForm, "path", acSaveNo
MsgBox "Connection complete!", vbInformation, ""
End Sub
'---------------------------------------------------
actually it is not complete yet and is not what I need because it is lacking.
as you can see, when I click the Attach Button, only PathID Number 1 only will be attached because it is what in my strfilename criteria.
What I would like to achieve is:
after I have attached the database with pathID #1, use the database path and name, locate all the tables present on that database and link it.
then, it will go to the next record that is pathID#2 and attach it and so on so forth up to the last pathID.
I was thinking that Do while statement would be the solution but I dont know how to use it to achieve what I need to do!
Kindly help me out again.
I have this attached picture "paths.jpg"
the purpose of this paths is for easy linking procedure. the form is a countinous form which has only three fields: pathnameid,pathname,pathlocation
And I have this code:
'-------------------------------------------------
Private Sub attach_Click()
Dim wrk As Workspace
Dim dbBack As Database
Dim strTable As String
Dim strFileName As String
Set wrkDefault = DBEngine.Workspaces(0)
strFileName = DLookup("pathlocation", "path", "pathnameid = 1")
Set dbBack = wrkDefault.OpenDatabase(strFileName, False, False, "MS Access;PWD=""")
DoCmd.TransferDatabase acLink, "Microsoft Access", dbBack.Name, acTable, "companybranch", "companybranch", False, True
DoCmd.close acForm, "path", acSaveNo
MsgBox "Connection complete!", vbInformation, ""
End Sub
'---------------------------------------------------
actually it is not complete yet and is not what I need because it is lacking.
as you can see, when I click the Attach Button, only PathID Number 1 only will be attached because it is what in my strfilename criteria.
What I would like to achieve is:
after I have attached the database with pathID #1, use the database path and name, locate all the tables present on that database and link it.
then, it will go to the next record that is pathID#2 and attach it and so on so forth up to the last pathID.
I was thinking that Do while statement would be the solution but I dont know how to use it to achieve what I need to do!
Kindly help me out again.