A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

help with code



 
 
Thread Tools Display Modes
  #1  
Old March 28th, 2007, 05:58 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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  
Old March 28th, 2007, 06:04 PM posted to microsoft.public.access.tablesdbdesign
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old March 28th, 2007, 06:46 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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  
Old March 28th, 2007, 07:18 PM posted to microsoft.public.access.tablesdbdesign
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old March 28th, 2007, 08:22 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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  
Old March 28th, 2007, 08:31 PM posted to microsoft.public.access.tablesdbdesign
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old March 28th, 2007, 08:44 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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  
Old March 28th, 2007, 08:55 PM posted to microsoft.public.access.tablesdbdesign
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old March 28th, 2007, 09:16 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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  
Old March 28th, 2007, 09:20 PM posted to microsoft.public.access.tablesdbdesign
sue gray
external usenet poster
 
Posts: 54
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.