Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Pull Up Help

Status
Not open for further replies.

Igawa29

MIS
Jan 28, 2010
99
US
On my form I have a dropdown box and then a button. The dropdown box houses different numbers 1 - 10, and the button when clicked is supposed to open a PNG file based on an if/then statement. The problem is I am not sure what VBA code I need to write behind my button in order to have the PGN file pull up. Any ideas?
 


Hi,

Idea 1: Post sample .png file names

Idea 2: Post what relevance the ComboBox selection has to the logic

Idea 3: Post your if-then logic in plain terms.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Alrighty,
Here is what I have:

PNG file names: Report001.png, Report002.png, Report003.png

The combo box has the following values:
Report001, Report002, Report003.

This is what I want the button to do:
Code:
If me.Report.value = "Report001" then
***Need to figure out how to pull up the Report001.pgn file****
End if 

If me.Report.value = "Report002" then
***Need to figure out how to pull up the Report002.pgn file****
End if


Let me know if I can give you any more info.
 


The dropdown box houses different numbers 1 - 10

The combo box has the following values:
Report001, Report002, Report003.
Are you referring to something different or what?

Why do you think that you need an If...Then statement???
Code:
dim sFileName as string

sFileName = me.Report.value & ".pgn file"


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I meant the same thing with the first quote and the second quote.

The reason I wanted to use the if then statement was because once the button was clicked I would want to make sure the correct file opened.

I put if then statements all over my vba code, since that was the way I learned things, are you saying I can get around this?

So if I select Report001 from the drop down box, then I click my button, what tells Access to open the Report001.pgn file?
 



Please explain how an IF...Then statment would ensure "the correct file opened" any better than the posted suggestion.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
It my fault Skip for not understanding the context on how to use your piece of code. Where would I put the file path for the pgn code using your coding example?

If your code works I am going to have to go back through and get rid of all my if then statements :) I love this forum
 




Code:
path & "\" & sFileName


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Very nice, works and is pefect.. thank you so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top