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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP with access data page

Status
Not open for further replies.

rat22

Programmer
Aug 13, 2001
3
US
I need some serious help. Im a VB/VBA programer and this html java crap is confusing as hell. I need a button to save a record and then launch a second web page a thank you splash page. How in the world do I do that?
Jim
 
You didn't mention which version of Access you're developing in, but it can be done in 97 or 2000. I develop in 97 because our user community is not totally on 2000 yet. Here's how you can do it in Access 97. See note at bottom for Access 2000.

You can create a macro with a RUNCODE action to handle the record save, and another RUNCODE that would perform function name opnHyperlink ([txtAppLocation]) . My routine, named opnHyperlink, accepts a single input parameter containing the name of an Access database I want opened. The input parameter comes from a text box named [txtAppLocation].
In your application, you can put the URL to the web page you want opened in the text box; e.g. D:\HTML\DMV_Table.html. Note that you'll need to supply the path, but that's not hard to get.
Create a module similar to the following:

Function opnHyperlink(ByVal strInput As String)

On Error GoTo Error_opnHyperlink
Application.FollowHyperlink strInput
opnHyperlink = True

Exit_opnHyperlink:
Exit Function

Error_opnHyperlink:
MsgBox "Could not open the application."
opnHyperlink = False
Resume Exit_opnHyperlink

End Function


Now that you have the module, create a macro with the runcode actions mentioned above. Finally, in your form, put the macro name on the On Click property of the button you want to have trigger the action.

To get the hyperlink path to your web page, open a form in design mode, and click on any control, a command button will work fine. Now look at the properties for that control and click the ALL tab. Notice there's a property called Hyperlink Address. Click to the right end of that line on the build button, and an Insert Hyperlink box comes up. On the "Link to file or URL" line click browse, then navigate to the web page you want opened. Once you find, click on it, then highlight and copy the URL, cancel out of design mode, then paste the URL into the text box. Try this as a test to get a feel for how it works, then when you get the hang of it, you can dynamically change the contents of that text box and open any document you want using that routine.

If the URL of the web page to be opened never changes, you could simply put the web page URL in the Hyperlink Address property of the associated command button.

In Access 2000 there is a FollowHyperlink action in macros, so it's not quite as involved. We have to develop things at the lowest level here in order to support a mixture of Access 97/2000 users successfully, so it's a bit more involved, but it works.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top