Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2011
    Posts
    3

    Question Unanswered: Clickable Links to Tables Help

    OK I am trying to figure out how to do this. I have a subform that brings in my table data via text boxes. They are all hyperlinked except for one field. The hyperlinks open xls files outside of the Access program. What I need the other field to do is for the user to click on the text box and have it open a table within Access. I know hyperlinks can be set up manually for these data fields, however these are updated monthly and there are over 2,000. Is it possible to set up vba to look at the text box field and to determine which table to open for the user? I am really stuck on this one, not sure even how to google this question.

    Any help will be appreciated.

  2. #2
    Join Date
    Oct 2009
    Posts
    340
    Your post is unusual. Not sure if I understand what you are saying.

    A table is a record source for a form. You open the form, and see the data in the table.
    www CahabaData com

  3. #3
    Join Date
    Apr 2011
    Posts
    3
    Sorry if I didn't explain correctly. The subform is being populated by a table with 7 hyperlinked fields and a normal text field. The hyperlinked fields link correctly to xls files that are sitting on my computer. The trouble starts with the text field. I want to be able to click on for example Batters_20, and that will bring up my Batters_20 table, or if I click on Pitchers_14, I want that to bring up my Pitchers_14 table. So I want Access to hyperlink this table field to open other tables.. I know how to do this by right clicking the field and navigating to the "Other objects in this project" and assigning it manually.. however I need to figure out a vba statement that can automatically open these links since these tables will be updated monthly.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Code:
    DoCmd.OpenTable "<TableName>", acViewNormal, acEdit
    Will open the table <TableName>. However I must seriously warn you that opening a table directly is against all good practices.
    Have a nice day!

  5. #5
    Join Date
    Apr 2011
    Posts
    3
    Thank you I understand the logic behind that, however I want code that will give me an if, then, else statement.

    For example, (mind you not the right syntax)

    Code:
    sub formvalue.afterclick()
    
    if me.textbox1.value = 'Batter_20' then DoCmd.OpenTable "<Batter_20>", acViewNormal, acEdit
    if me.textbox1.value = 'Pitcher_13' then DoCmd.OpenTable "<Batter_14>", acViewNormal, acEdit
    else if me.textbox1.value = ' ' then (not sure how to end this.. just want to say do nothing)
    
    
    end sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •