Log in

View Full Version : Why is this code not taking me where I want to go?



MrsC
01-16-2008, 04:37 PM
Working on anther code so that when I click the command it will bring me to the directory on my computer where the file is stored.

Here is the code I've been working on:
'########################################
' Open Master Insco Look Up file
'########################################
Private Sub cmdMstrInsco_Click()
On Error GoTo Err_cmdMstrInsco_Click
'-------------------------------------------------------------
'Open Master Insco Look Up File in Access
'-------------------------------------------------------------
' stAppName = "S:\QA2\MasterInscoLookup\InscoLookup.mdb"
ShellExecute 0&, vbNullString, FMname, vbNullString, vbNullString, vbNormalFocus
'-------------------------------------------------------------
'Read the contents of the text file created by the batch script
'-------------------------------------------------------------
' AllText$ = ""
stAppName = "S:\QA2\MasterInscoLookup\InscoLookup.mdb"
'-------------------------------------------------------------
'This is a File Lookup Record
'-------------------------------------------------------------
' PathToBurnDirectory.SetFocus
' PathToBurnDirectory.Text = ""
' cmdBurnDir.Enabled = False
'-------------------------------------------------------------
'Text file error handling
'-------------------------------------------------------------
Exit_cmdMstrInsco_Click:
Exit Sub
Err_cmdMstrInsco_Click:
MsgBox Err.Description
Resume Exit_cmdMstrInsco_Click
End Sub

______________________________________________________

I'm sure that its' a mess to those that are used to working with this. Now when I click my command button, it does open but only to "My Documents". It doesn't follow the path "S:\QA2\MasterInscoLookup\InscoLookup.mdb"

Any insight would be greatly appreciated.

rconverse
01-16-2008, 06:45 PM
Hello MrsC. I am MrC. Okay, that was lame...

Not sure, if this is the cause, but you don't have stAppName declared as a variable. It appears that you don't have FMname declared either, but that doesn't seem to be the issue for you.

Just by looking at the code, I can't really tell what is going on, but here are my observations. I don't expect them to correct your issue, but maybe spark some thoughts for you.

This intrigues me:



stAppName = "S:\QA2\MasterInscoLookup\InscoLookup.mdb"


It appears that you don't do anything with this after you set the filepath to the value, so I am not sure that it would ever come into play.



' stAppName = "S:\QA2\MasterInscoLookup\InscoLookup.mdb"
ShellExecute 0&, vbNullString, FMname, vbNullString, vbNullString, vbNormalFocus
'-------------------------------------------------------------
'Read the contents of the text file created by the batch script
'-------------------------------------------------------------
' AllText$ = ""


I don't know what this is because it is not declared. Is that a value that you expect?

Again, I doubt I am solving anything, but maybe just helping you revisit some of this stuff will help you figure out what is going on or not going on.

HTH
Roger

MrsC
01-16-2008, 08:45 PM
Just wanted to say that I figured it out.


stAppName = "S:\QA2\Master InscoLookup\InscoLookup.mdb"

This actually needed a space; can you believe it, a bloody space!!!:banghead:

That and when I copied this code from another command_click, I didn't change the FMname to stAppName.

Once I took the little ' off of it to make it an active variable? (is that the correct terminology) it worked like a charm!

I think I'm in over my head..... :dunno

rconverse
01-17-2008, 09:14 AM
Just wanted to say that I figured it out.


stAppName = "S:\QA2\Master InscoLookup\InscoLookup.mdb"

This actually needed a space; can you believe it, a bloody space!!!:banghead:

That and when I copied this code from another command_click, I didn't change the FMname to stAppName.

Once I took the little ' off of it to make it an active variable? (is that the correct terminology) it worked like a charm!

I think I'm in over my head..... :dunno

Yes, that is the correct terminology. So I wasn't too far off in what I was seeing. Good to know.

Thanks,
Roger