If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
help with code
I copied this code from this site. It looked like it would work for me. I
am trying to scan documents into a folder and give the document a name Contract*.pdf With their client id after contract. However I keep getting an error 490. I know the problem is in the strfilespec line, but I can't fiqure it out. I'm just learning to code. If I leave off the & strfilespec on the last line it takes me to the correct directory. Thanks for any help. Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\server\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") & ".pdf" Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub |
#2
|
|||
|
|||
help with code
sue gray wrote:
I copied this code from this site. It looked like it would work for me. I am trying to scan documents into a folder and give the document a name Contract*.pdf With their client id after contract. However I keep getting an error 490. I know the problem is in the strfilespec line, but I can't fiqure it out. I'm just learning to code. If I leave off the & strfilespec on the last line it takes me to the correct directory. Thanks for any help. Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\server\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") & ".pdf" Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub That code is trying to OPEN the file at the specified location. That has nothing to do with "scan documents into a folder and give the document a name Contract*.pdf". You'll need to be more specific about what you are attempting to accomplish. If you are trying to CREATE files then FollowHyperlink is not going to get it done. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
help with code
Sorry for not being clear. I have scanned documents into the mgt folder on
my network. I am trying to open the documents based upon the name ex: contract_000123.pdf would belong to client 000123. I hope this helps. Thanks for the response, "Rick Brandt" wrote: sue gray wrote: I copied this code from this site. It looked like it would work for me. I am trying to scan documents into a folder and give the document a name Contract*.pdf With their client id after contract. However I keep getting an error 490. I know the problem is in the strfilespec line, but I can't fiqure it out. I'm just learning to code. If I leave off the & strfilespec on the last line it takes me to the correct directory. Thanks for any help. Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\server\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") & ".pdf" Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub That code is trying to OPEN the file at the specified location. That has nothing to do with "scan documents into a folder and give the document a name Contract*.pdf". You'll need to be more specific about what you are attempting to accomplish. If you are trying to CREATE files then FollowHyperlink is not going to get it done. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#4
|
|||
|
|||
help with code
sue gray wrote:
Sorry for not being clear. I have scanned documents into the mgt folder on my network. I am trying to open the documents based upon the name ex: contract_000123.pdf would belong to client 000123. I hope this helps. Thanks for the response, In that case I see nothing wrong with your current code. Add a line of code... Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\server\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") &".pdf" Debug.Print CONTRACTS_FOLDER & strFilespec Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub ....and then check the output of the Print in the VBA debug window. It might show you what is wrong. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#5
|
|||
|
|||
help with code
I really hate to be such a pest but I don't know how to "....and then check
the output of the Print in the VBA debug window. It might show you what is wrong." Thanks for the help. "Rick Brandt" wrote: sue gray wrote: Sorry for not being clear. I have scanned documents into the mgt folder on my network. I am trying to open the documents based upon the name ex: contract_000123.pdf would belong to client 000123. I hope this helps. Thanks for the response, In that case I see nothing wrong with your current code. Add a line of code... Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\server\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") &".pdf" Debug.Print CONTRACTS_FOLDER & strFilespec Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub ....and then check the output of the Print in the VBA debug window. It might show you what is wrong. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#6
|
|||
|
|||
help with code
sue gray wrote:
I really hate to be such a pest but I don't know how to "....and then check the output of the Print in the VBA debug window. It might show you what is wrong." Thanks for the help. The line... Debug.Print CONTRACTS_FOLDER & strFilespec ....will cause the result of that expression to be evaluated and written to the Immediate pane visible in the VBA editor. Just press Ctl-G to open that window after running your code. You should see the results there. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#7
|
|||
|
|||
help with code
I got the immediate pane, but it's blank.
"Rick Brandt" wrote: sue gray wrote: I really hate to be such a pest but I don't know how to "....and then check the output of the Print in the VBA debug window. It might show you what is wrong." Thanks for the help. The line... Debug.Print CONTRACTS_FOLDER & strFilespec ....will cause the result of that expression to be evaluated and written to the Immediate pane visible in the VBA editor. Just press Ctl-G to open that window after running your code. You should see the results there. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#8
|
|||
|
|||
help with code
sue gray wrote:
I got the immediate pane, but it's blank. Did you look at it AFTER running the code? If so, post your exact code as it is now. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#9
|
|||
|
|||
help with code
I am looking at it after I run it. But I am really out of my league. I'm
not sure we are talking the same language. Here's my code, I really appreciate your help. Private Sub Command126_Click() Dim strFilespec As String Const CONTRACTS_FOLDER = "\\mchdnt\data\mgt\" strFilespec = "Contract_" & Format(Me.clientid, "000000") & ".pdf" Debug.Print CONTRACTS_FOLDER & strFilespec Application.FollowHyperlink CONTRACTS_FOLDER & strFilespec End Sub "Rick Brandt" wrote: sue gray wrote: I got the immediate pane, but it's blank. Did you look at it AFTER running the code? If so, post your exact code as it is now. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#10
|
|||
|
|||
help with code
If I take off the & & strFilespec on the last line I get me path and filename
in the immediate pane. Hope this helps. Sue "Rick Brandt" wrote: sue gray wrote: I got the immediate pane, but it's blank. Did you look at it AFTER running the code? If so, post your exact code as it is now. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
|
Thread Tools | |
Display Modes | |
|
|