If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > using VBA to store Access 2007 report values as variables?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-06-11, 18:13
lockdavid lockdavid is offline
Registered User
 
Join Date: Jul 2011
Posts: 1
using VBA to store Access 2007 report values as variables?

Hi,

I'm fairly new to Access and VBA and I'm entirely self-taught (via google and extremely helpful sites like this one), so please forgive me if this is a stupid question.

I have an Access 2007 report that calls a query to display information about individual entries in an online database. Each cell in the report has individual bits of information that together make up the URL for the web page. I could end up with a report that looks like this:

__________COLOR___NUMBER___ANIMAL
row 1:____red_____five_____tiger
row 2:____blue____two______lion
row 3:____green___seven____penguin

And, for example, I'd need to open up this url:

http://www.davesdata.com/red/five/tiger
or
http://www.davesdata.com/green/seven/penguin

I currently have it set up so that I can click a button and a bit of VBA code is called that asks me for each piece of data, which I then have to type in manually:

------------------------------------
Public Function createLink()

Dim color As String
system = InputBox(Prompt:="Enter the Color:", _
Title:="Color", Default:="")

Dim number As String
number = InputBox(Prompt:="Enter the Number:", _
Title:="Number", Default:="")

Dim animal As String
animal = InputBox(Prompt:="Enter the Animal:", _
Title:="Animal", Default:="")

FollowHyperlink Address:="http://www.davesdata.com/" & color & "/" & number & "/" & animal & ""

End Function
------------------------------------

But what I want to do is add a button on each row of the report that, when clicked, will call a VBA script to populate the variables with the appropriate values from that row to plug them into the URL.

I haven't been able to find a way to refer to the individual cell values on a particular row of a report and store them as variables.

I am grateful for any information or assistance!

Thanks,
Dave
Reply With Quote
Reply

Tags
access 2007, vba

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On