Database Location

P

Pierre

How would I change a file location to read something like Database Location
plus folder name. I need to be able to more my data base with associated
folders w/o having to change codes in data base with folder location. I
currently have (server)

"\\homeserver\homes\user\My Documents\Pictures"

' Need to read something like
"= db location & "\Pictures""

Note: I have tried this and it does not work.
 
P

Pierre

Below is a code being used to locate the db without creating a module. I
would just like to modify it so that I can add the picture folder.

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

' Not here is what I'm currently using and would just like to change file
path to db location & picture folder.

Private Sub Res_Home_AfterUpdate()
Dim PictureField As Integer
On Error GoTo Picture_Error
If Not IsNull ([Res Home]) Then
Me.Image501.Picture = "\\Homeserver\home\user\picture\ &" [Res Home]
Else
Me.Image501.Picture = "(none)"
Exit Sub
Picture_Error:
If Err.Number = 2220 Then
MsgBox "Err: & Err.Description
End if
Resume Next
End Sub
 
Y

Yanick

In the following code,

Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))

pathname is a string. All you have to do is concatenate what you need at the
end of it. For exemple, if pathname = "C:\Database\" then do this :

pathname = pathname & "ImageFolder\"
Me.Image501.Picture = pathname & [Res Home]

I guessed [Res Home] is the path or file name of your image.

Hope this is what you need.
 
P

Pierre

man....I am impressed by the over whelming knowledge of people on here
everyday. Pathname is what I was looking for. BTW [Res Home] is the name of
the txtbox field that the name of the image is entered.

'NOTE: I entered it in this fashion
Me.Image501.Picture = pathname & "\picture\" & [Res Home]

--
Work is sometimes hard....but someone has to do it.


Yanick said:
In the following code,

Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))

pathname is a string. All you have to do is concatenate what you need at the
end of it. For exemple, if pathname = "C:\Database\" then do this :

pathname = pathname & "ImageFolder\"
Me.Image501.Picture = pathname & [Res Home]

I guessed [Res Home] is the path or file name of your image.

Hope this is what you need.
--
Yanick


Pierre said:
Below is a code being used to locate the db without creating a module. I
would just like to modify it so that I can add the picture folder.

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

' Not here is what I'm currently using and would just like to change file
path to db location & picture folder.

Private Sub Res_Home_AfterUpdate()
Dim PictureField As Integer
On Error GoTo Picture_Error
If Not IsNull ([Res Home]) Then
Me.Image501.Picture = "\\Homeserver\home\user\picture\ &" [Res Home]
Else
Me.Image501.Picture = "(none)"
Exit Sub
Picture_Error:
If Err.Number = 2220 Then
MsgBox "Err: & Err.Description
End if
Resume Next
End Sub
 
Y

Yanick

I am glad it helped you!

--
Yanick


Pierre said:
man....I am impressed by the over whelming knowledge of people on here
everyday. Pathname is what I was looking for. BTW [Res Home] is the name of
the txtbox field that the name of the image is entered.

'NOTE: I entered it in this fashion
Me.Image501.Picture = pathname & "\picture\" & [Res Home]

--
Work is sometimes hard....but someone has to do it.


Yanick said:
In the following code,

Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))

pathname is a string. All you have to do is concatenate what you need at the
end of it. For exemple, if pathname = "C:\Database\" then do this :

pathname = pathname & "ImageFolder\"
Me.Image501.Picture = pathname & [Res Home]

I guessed [Res Home] is the path or file name of your image.

Hope this is what you need.
--
Yanick


Pierre said:
Below is a code being used to locate the db without creating a module. I
would just like to modify it so that I can add the picture folder.

Private Sub Form_Activate()
'find the path of the current database
'which is where the jpegs are stored
Set db = CurrentDb
filename = db.Name
pathname = Mid(filename, 1, Len(filename) - Len(Dir(filename)))
End Sub

' Not here is what I'm currently using and would just like to change file
path to db location & picture folder.

Private Sub Res_Home_AfterUpdate()
Dim PictureField As Integer
On Error GoTo Picture_Error
If Not IsNull ([Res Home]) Then
Me.Image501.Picture = "\\Homeserver\home\user\picture\ &" [Res Home]
Else
Me.Image501.Picture = "(none)"
Exit Sub
Picture_Error:
If Err.Number = 2220 Then
MsgBox "Err: & Err.Description
End if
Resume Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top