Database Location

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.
-- 
Work is sometimes hard....but someone has to do it.
0
Utf
1/28/2008 3:03:01 PM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
816 Views

Similar Articles

[PageSpeed] 44

I think that should do what you need.

http://www.blueclaw-db.com/current_path_directory.htm

-- 
Yanick


"Pierre" wrote:

> 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.
> -- 
> Work is sometimes hard....but someone has to do it.
0
Utf
1/28/2008 3:32:01 PM
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

0
Utf
1/28/2008 4:06:00 PM
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" wrote:

> 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
> 
0
Utf
1/28/2008 4:38:00 PM
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" wrote:

> 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" wrote:
> 
> > 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
> > 
0
Utf
1/28/2008 5:18:03 PM
I am glad it helped you!

-- 
Yanick


"Pierre" wrote:

> 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" wrote:
> 
> > 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" wrote:
> > 
> > > 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
> > > 
0
Utf
1/28/2008 5:44:03 PM
Reply:

Similar Artilces:

Allowing Users to Run Queries Without Showing the Database Window
I have an access front end that connects to a SQL backend, and is designed in such a way that the users never see the database window or default access database menu bar, only the forms and menus that I want them to see. Specifically: 1. I have set a startup form 2, I have unchecked the following option in the startup: I want to know if it's possible to keep this configuration but allow the users the ability to create and run access queries against back end views, and allow them to export the results to an excel spreadsheet. -- Message posted via http://www.accessmonster.com ...

AutoArchive location
Hi all, Question: Can you set a policy where the AutoArchive location is going? Any registry entry that can be changed? Thank you in advance. "Rully Kusuma" <anonymous@domain.com> wrote in message news:uyQJZuijFHA.1232@TK2MSFTNGP15.phx.gbl... > Question: Can you set a policy where the AutoArchive location is going? > Any registry entry that can be changed? Outlook Profiler to the rescue!!! http://goffconcepts.com/products/windows/profiler/index.html Helpful Hints GOFF Concepts This KB article explains how to accomplish this with a PRF file: = http://su...

Locating xmlns nodes in XML documents (for XML document metrics)
I've been writing an XML document analyzer that reads XML document and tracks the metrics of the document. Statistics such as a node count fo each type of XML node are printed out I am trying to locate 'xmlns' nodes using the XPath (not DOM or SAX) API Unfortunately the XPathNavigator concept of namespace nodes for eac element is only accessible via MoveToFirstNamespace() an MoveToNextNamespace(). The XPath model constructs a namespace node lis for EACH ELEMENT where each namespace node represents a namespace CURRENTL IN SCOPE for the current XML node I would like to easily loca...

Distinct column from database
Hi, i am subas and wants help from u for my problem in database programming. i wants use distinct keyword in the Open fuction of the CRecordset to retrieve distinct values from the field of the student table.i use the following code but it doesn,t work.if any body has this problem and any body solve my problem thanks in advance.. if(!rs.IsOpen()) rs.Open(NUll,"select distinct vc_place from student",FALSE); Hi, Why is the first parameter of your call to Open NULL? Shouldn't it be something like CRecordset::dynaset or CRecordset::snapshot or such? Why is the third ...

Password protecting a linked database
I have a front end user interface with a backend database (the frond end links to the database using linked tables). The front end of the database has user level security applied to it and that works fine. The problem is that the backend database does not have any security applied to it and a user can easily open open the database and play around with the data. Is there a way of password protecting the backend database so users cannot gain access do the database? Mark wrote: > I have a front end user interface with a backend database (the frond > end links to the database using linked...

does Exchange save user contacts in the database?
I just have a simple question. Contacts that are in the user's mailbox and not in the global address list, do those get saved to the database? for example, if I had to restore a user's mailbox, would those contacts be there? On Tue, 7 Nov 2006 09:27:01 -0800, Gilbert <Gilbert@discussions.microsoft.com> wrote: >I just have a simple question. Contacts that are in the user's mailbox and >not in the global address list, do those get saved to the database? > >for example, if I had to restore a user's mailbox, would those contacts be >there? Yes. On ...

office 2008-database error every time when starting an application
Hi all,<br> I receive 'There is a problem with the office database' error every time I start an office application. For an example, here is the error when starting word:<br> &nbsp;&lt;http://arifb.com/officeError/office%202008%20error.tiff&gt;<br> <br> I recently upgraded to Leopard, and used migration assistant to move over office. That is when I started receiving this error. I wasn't even able to rebuild the database so I decided to uninstall. I then reinstalled and still get the error. I am able to rebuild the database now but doing so does no...

connecting excel to a database
how to prepare a form in excel so that it gets saved in the database and we can fill it and send it to the database. and we can retrieve it for future reference? Why not just create a form in Access? "bhanu" wrote: > how to prepare a form in excel so that it gets saved in the database > and we can fill it and send it to the database. and we can retrieve it > for future reference? > > On Jul 6, 7:53 am, bhanu <bhanupriy...@gmail.com> wrote: > how to prepare a form in excel so that it gets saved in the database > and we can fill it and send it to t...

My Access database gets bigger each time I open it
Each time I use my Access 2007 application it increases in size whether or not I add data. I have to use "Compact and Repair" each time to keep its size down. This happened with the previous Access 2003 version and also with the Runtime version I've just created. How do I stop this happening? You don't stop it. Every time that the database opens after a compact, it recompiles the code and queries as they are used. This causes increases in the database size, as does adding data. Unless you are storing large binary objects, or doing design work, the size should not inc...

connect a form to excel database
I have a database in excel which lists our stock and prices etc. I would like to be able to enter a stock number on an invoice that will retrieve the details and price from my excel database. Can this be done? Excel has built in option--try data|form. If that doesn't quite work, but it's close, John Walkenbach has an enhanced dataform at: http://j-walk.com/ss/dataform/index.htm And if you want to design your own, Debra Dalgleish has a get started with userforms: http://contextures.com/xlUserForm01.html Kathy wrote: > > I have a database in excel which lists our stock and p...

Exchange 5.5 database to exchange 2003
Hi, we are under exchange 2003 migration part. We are already maintaing exchange server 5.5 . Our server Database size is 14GB(EDB). I would like to know how to move Both publec and privated edb files to exchange server 2003 stoarage group. Thanks In advance. Suresh Gopal As a part of your Exchange 2003 migration, you should have joined the new Exchange 2003 to the Exchange 5.5 site When you go into the Exchange System Manager of Exchange 2003, make sure you can view both the servers. Once you have verified this: You will need to move the mailboxes from the 5.5 server to the 2k3 (2003) ...

save a entry in database for the items in list
I want to create these fields: coloumn a: a drop down list of names column b: drop down list of dates column c: drop down list of some numbers and alphabets I want to corelate all these three columns for the item selected. eg: if i select name "john" from column a and "1/1/6" from column b and select "4" from coumn c then i need a report generated which will mention "john" on "1/1/6" had "4" units and "john" from "1/1/6" to "31/1/6" had "?? total units" Can some one help create the same. H...

Using Excel DataBase to do e-mail merge
I'd like to send an e-mail to each person in my excel spreadsheet. How can I do this Outlook e-mail merge. Have you looked at the help files? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Dennis asked: | I'd like to send an e-mail to each person in my excel | spreadsheet. How can I do this Outlook e-mail merge. ...

Cube building doesn't update PS database? HELP!
hi All, i have some problem with my ProServer 2003 when i want to build cube manualy the proces start and i get two errors and two warnings in event viewer (when i start processing from analysis menager i don't have any errors but after build i don't see NEWest result in portfolio analyzer): 1. Component: PCSViews File: ViewsDrop.cls Line: -1 Description: <Description><![CDATA[Error Information: Additional Information: An error occured calling CallViewGenerator(projectserver, -1, <ProjectData> <EntProjectName><![CDATA[resglobal] ]>&l...

Cannot update. Database or object is read-only (re-post)
I posted this about a month ago and didn't get anywhere with it. I have been struggling with different possible solutions but still cannot get this form to work as expected. Initially the form opened based on a sub-query which worked just fine. However, I could not get the records to write to a new table, I would get the above noted error message. Thinking that this had something to do with the limitations of opening the form based on a sub-query, I have changed tactics and instead have the form open bound to a temporary table, however, I still cannot write the records to a "perman...

Opening Report Closes Database
I have a report with a subreport that closes the database every time I try to Preview it or open it in Design View. The subreport will also do this if I try to open it independently. The queries work fine. The report wasn't doing this for the last couple of days, then this morning it started doing it if the window was maximized. If I clicked to restore the view to a smaller size and then closed the report this didn't happen. Now it happens every time. I have tried to compact and repair with no luck. Is there anything I can do besides recreate these? Thanks in adva...

Onepoint Database is full
My Onepoint Database is full (1GB), what should I do? Gonzo wrote: > My Onepoint Database is full (1GB), what should I do? > > And that has what to do with exchange? OnePoint is a MOM feature you may wish to look into other newsgroups. is this related to Exchange server, in some way? -- Susan Conkey [MVP] "Gonzo" <no@spam.com> wrote in message news:eGsSMcK7GHA.4408@TK2MSFTNGP02.phx.gbl... > My Onepoint Database is full (1GB), what should I do? > 1. make it bigger 2. adjust the grooming parameters 3. go to the MOM newsgroups for assistance. &qu...

how can i protect my database from DELETION
Is there anyway to protect a Access Database File from "deletion". I mean, wherever we save the *.MDB file, no one will be able to delete it. Because, Access will ask PASSWORD to confims deletion. Regards. hi, mezzanine1974 wrote: > Is there anyway to protect a Access Database File from "deletion". As you need full access to it, no. > I mean, wherever we save the *.MDB file, no one will be able to delete > it. Use the shadow copy mechanism to backup your .mdb in short intervals. mfG --> stefan <-- Hi, Try looking into Sharing and Security of a Folde...

copy entire database over to linked server
I just setup a linked server that is provided through our ISP. Our database is setup as merge replication that is pushed to four remote locations all running sql server. I want to setup the linked server with the same database. What is the best way to do this? Can I configure merge replication with the linked server so it is always up to date? We are using SQL SERVER 2000 WB WB Do you want to loop throu all tables and copy them into another server? Where do you want to create a linked server ? On main office to point to locations? "WB" <none> ...

what is a database?
what is a database? "fm11" <fm11@discussions.microsoft.com> wrote in message news:FA5C8535-A31F-4788-BD45-42698CE448B7@microsoft.com... > what is a database? http://en.wikipedia.org/wiki/Database Contrary to some, Excel is not a database. Tyro "fm11" <fm11@discussions.microsoft.com> wrote in message news:FA5C8535-A31F-4788-BD45-42698CE448B7@microsoft.com... > what is a database? fm11 -- A database is a structured set of information. In Excel, it's often a table of information. Across the top, you have headings (First name, Last name,...

cannot open database because VBA project cannot be read
Without any provocation that I can think of, I got the message above after opening my database this morning. The message further states that the only way that the database can be opened is to delete the VBA project and all code from modules, forms, and reports. This is a highly undesirable option. Yes, I do have backups I can resort to, but I'd rather not if there is a workaround. The database has a meager bit of VBA associated with some forms and reports, and I hadn't touched any of it for some time. Has anybody seen this error? Access help was not helpful. AccessMan <...

Exchange 2003 Database Size Question #2
Dear all, Is there a way to determine the actual storage space used by the Exchange 2003 database? I am asking this because the physical file size is not an indicator as this is the high watermark size, meaning that it does not shrink even users have deleted and purge their email. Thanks. Regards, Kueh. "KA Kueh" <kka@ksm.com.my> wrote: >Is there a way to determine the actual storage space used by the Exchange >2003 database? I am asking this because the physical file size is not an >indicator as this is the high watermark size, meaning that it does not ...

Database Export Wizard Problem
Hi! I am trying to link a shape in an existing drawing to data base, i.e. an Excel File. I do: Tools->Add Ons->Viso Extras->Database Wizard Next Select "Link shapes to database records" Next Select "Shape(s) in a drawing" Next Select a Shape Next Select "Excel Files" Next Select an Excel File Now, I get a box in which I am forced to choose a "table". But the selection list shown is empty. When I try to create a "table" (whereas it is unclear how the field I define relate to the shape I am going to link to the external DB), I get...

Creating auto loan database
Very rusty beginning access user wants to create db to track, record, and calculate car payments made by customers at used car lot. Currently using excel spreadsheet for each loan. Need help with structure of db. I think I need the following tables: Customer information (Name, address, original loan amount, etc..) Transactions (Date pmt made, amt of payment) Would like to create form to record payments, with a subform, that will show previous payments made and showing current outstanding balance. I suspect I have to create a one to many relationship between customers and transactions. B...

FP 2003 Database Results Wizard
From FP 2003 when I click on "Insert" and then "Database", the "Results" option is greyed out. The only option available is "Data View". How can I restore the "Results" option? Tools->Page Options - Authoring tab Tick the box "Author-time Web Components" -- Ron Symonds Microsoft MVP (Expression Web) http://www.rxs-enterprises.org/fp Reply only to group - emails will be deleted unread. "Bob L" <nospam@nospam.com> wrote in message news:elDmhIkXKHA.3720@TK2MSFTNGP02.phx.gbl... > From ...