Results 1 to 4 of 4
  1. #1
    ria87 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    2

    combine ms access with notepad

    Currently i have transfer button inside my access application to transfer value to another server.

    However i have difficulty when the server name is changed i should update the code in the application.

    Instead of that can i remove the server name inside the access code and put it in the notepad?

    so if in the future the server name change again i only should update the notepad, not the access application itself.

    If can can you let me know how? thanks very much.

    please find my code below:

    Private Sub cmdTransfer_Click()
    Dim strSource As String
    Dim strABCTarget As String
    Dim strDEFTarget As String
    On Error GoTo Err_cmdTransfer_Click


    strSource = "I:\Appl\Rate.accdb"
    strABCTarget = "\\indln1\Shared\Appl\Rate.accdb"
    strDEFTarget = "\\indrel1\Shared\Appl\Rate.accdb"
    DoCmd.Hourglass True
    FileCopy strSource, strABCTarget
    FileCopy strSource, strDEFTarget
    DoCmd.Hourglass False
    MsgBox "Transferring is completed...", vbInformation
    Exit_cmdTransfer_Click:
    Exit Sub

    Err_cmdTransfer_Click:
    DoCmd.Hourglass False
    MsgBox Err.Description & "." & " Transfer failed.", vbExclamation
    Resume Exit_cmdTransfer_Click
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    I guess you could have code in the cmdTransfer Click event that first reads the text file and pulls server name from there and sets a variable. Then concatenate that variable into the path string.

    Or you can save the server name in a table and the procedure could pull from the table into variable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ria87 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    2
    June,

    thanks for your reply. Could you give me an example of the code for your first suggestion? thanks for your information

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Google: access vba text file read

    http://www.excelforum.com/excel-prog...-variable.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 10-27-2012, 07:19 AM
  2. combine two tables into one.
    By chad740 in forum Access
    Replies: 2
    Last Post: 08-31-2012, 01:12 PM
  3. Combine three queries into one
    By Ray67 in forum Queries
    Replies: 8
    Last Post: 06-13-2012, 11:23 AM
  4. Combine multiple Excel sheets in Access
    By Adcock1969 in forum Access
    Replies: 17
    Last Post: 09-07-2011, 06:03 AM
  5. I have 4 Tables in Access - can I combine them?
    By officespace in forum Access
    Replies: 6
    Last Post: 02-22-2009, 07:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums