By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Open file based on combobox selection

P: 2
I'm working on an Access database and have a form with a combo box (a list of assembly plant locations), and I want a command button that will open the layout file for that plant.

I've got
Application.FollowHyperlink "<file location>"
which works, but I'm looking for a way to control what file is opened based on the selection in the combobox.
I tried
If ([Combo154]="<plant name1> Then
Else
If ([Combo154]="<plant name1> Then


Etc...

I also tried

If Combo154.Text.Contains("<Plant name>" Then

Etc

However both of those just made the command button do nothing (didn't even return error code)

Any suggestions?
Jan 30 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 5K+
P: 8,434
My first suggestion would be to put a break point in the code, run it, stop and display the values that the code is working with. Then you can determine why your IF isn't working as expected.

Get to know the VB debugging tools, they can be your best friend at a time like this.
Jan 30 '08 #2

P: 2
How would I do that? I'm new to VB, mostly let access create my code for me, and then just tweak it to do what I want. This project is my first real exposure to it.
Jan 31 '08 #3

Expert 5K+
P: 8,434
How would I do that? I'm new to VB, mostly let access create my code for me, and then just tweak it to do what I want. This project is my first real exposure to it.
Oh. Hope you're having fun, then.

Just put your cursor on the line where you want to interrupt execution, and hit F9. That should do a red highlight to show there's a breakpoint there. Then, when the code is executing and reaches that line, it will pause (before executing it)and wait for you to tell it what to do.

Using the tools available on the Debug toolbar (also on the Debug menu), you can then view or modify variable values, execute one statement at a time, and so on. Have a look through the documentation for the debugging tools, as they are invaluable for this sort of stuff.
Jan 31 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.