|
-
Nov 10th, 2000, 11:47 AM
#1
Thread Starter
Lively Member
I have an access database that has filenames of pictures stored in it. The filenames are written as "C:\filename". I need to write a program that accesses these filenames across the network, but I cannot access "C:\Filename". I need to access "\\ComputerName\C$\filename".
How can I place the text into a varible and then delete the first two characters? I know how to append what I need to on to it.
Or if there is a better way to do it how can I do it.
Thanks
Brandon
-
Nov 10th, 2000, 12:02 PM
#2
Fanatic Member
Code:
Private Sub Command1_Click()
Dim strTest As String
strTest = "c:\filename"
strTest = "\\ComputerName\C$" & Mid$(strTest, 3, Len(strTest))
MsgBox strTest
End Sub
[Edited by jbart on 11-10-2000 at 12:07 PM]
-
Nov 10th, 2000, 12:24 PM
#3
Member
change variable name
I think that the second "strtest" should be name "strtest2", is this correct JBart?
-
Nov 10th, 2000, 12:38 PM
#4
Fanatic Member
It seems to work correctly the way it is coded. The concept is similar to x = x + 1. You are just updating the variable with the result of an equation containing the variable. The result displayed in the message box is:
\\ComputerName\C$\filename
I suppose you could create a second variable to hold the result, but the following shows the same output.
Code:
Private Sub Command1_Click()
Dim strTest As String
strTest = "c:\filename"
MsgBox "\\ComputerName\C$" & Mid$(strTest, 3, Len(strTest))
End Sub
It's just an example to show that you can use the Mid$ function to drop off the first 2 positions of the filename contained in strTest.
[Edited by jbart on 11-10-2000 at 12:49 PM]
-
Nov 10th, 2000, 01:18 PM
#5
Thread Starter
Lively Member
Thanks Guys. I have the program working great. Thanks to you.
Brandon
-
Nov 10th, 2000, 01:33 PM
#6
Member
Dim X as string
x = replace(rsYourRecordset!YourPicture, "C:\Filename","\\ComputerName\C$\filename")
-
Nov 10th, 2000, 01:42 PM
#7
Fanatic Member
Originally posted by d.paulson
Dim X as string
x = replace(rsYourRecordset!YourPicture, "C:\Filename","\\ComputerName\C$\filename")
His program already works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|