PC Review


Reply
Thread Tools Rate Thread

Accessing a Varibly Named Table value in a Module called from a Form

 
 
dave b via AccessMonster.com
Guest
Posts: n/a
 
      24th Apr 2006
I have a form which collects parameters to run a report. One of the
parameters collects a list that populates a table. I wanted to make the list
table unique, so I create it when the user enters the form and delete it when
the user exits the form. I name the table "tblProductSelectFilling" & Hour
(Time) & Minute(Time) & Second(Time).

When the report is run a filter is built using the selected parameters. The
report works fine if the list table is using a stagnant name; however, I want
the query to have access to the timestamped list table whenever the user runs
the report.

I can pass the name of the table to the module that creates the filter, but
how do I use that varible to reference the value in the table?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200604/1
 
Reply With Quote
 
 
 
 
Douglas J Steele
Guest
Posts: n/a
 
      24th Apr 2006
It would probably be a little easier to name the table
"tblProductSelectFilling" & Format(Time(), "hhnnss")

That having been said, you can change the RowSource for your form to use the
table name you pass to it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"dave b via AccessMonster.com" <u19985@uwe> wrote in message
news:5f440ddaf4a34@uwe...
> I have a form which collects parameters to run a report. One of the
> parameters collects a list that populates a table. I wanted to make the

list
> table unique, so I create it when the user enters the form and delete it

when
> the user exits the form. I name the table "tblProductSelectFilling" &

Hour
> (Time) & Minute(Time) & Second(Time).
>
> When the report is run a filter is built using the selected parameters.

The
> report works fine if the list table is using a stagnant name; however, I

want
> the query to have access to the timestamped list table whenever the user

runs
> the report.
>
> I can pass the name of the table to the module that creates the filter,

but
> how do I use that varible to reference the value in the table?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200604/1



 
Reply With Quote
 
dave b via AccessMonster.com
Guest
Posts: n/a
 
      24th Apr 2006
I've decided to create the filter in the form, rather than a separate module.
After reading the threads, it's apparent that it's better to use the Where
condition in DoCmd.OpenReport, rather than the Filter.

The problem I'm having now is that even hardcoding the where, the report
doesn't filter for the desired results.
strReportWhere = "qryFillingDetailReport!ProductID = 'AMP'"
DoCmd.OpenReport "rptFillingDetail", acViewPreview, , strReportWhere

All product codes are reported.

And, yes, there are records where ProductID = 'AMP'.

Eventually, I want to replace the hardcoded AMP with the table and ProductID
the user selected.

Any help would be appreciated. Thanks.
Douglas J Steele wrote:
>It would probably be a little easier to name the table
>"tblProductSelectFilling" & Format(Time(), "hhnnss")
>
>That having been said, you can change the RowSource for your form to use the
>table name you pass to it.
>
>> I have a form which collects parameters to run a report. One of the
>> parameters collects a list that populates a table. I wanted to make the list

>[quoted text clipped - 9 lines]
>> I can pass the name of the table to the module that creates the filter, but
>> how do I use that varible to reference the value in the table?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200604/1
 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      24th Apr 2006
You don't need to qualify the field name with qryFillingDetailReport, since
the report's recordsource cannot have the same field name twice. Don't know
whether that's the cause of the error, though.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"dave b via AccessMonster.com" <u19985@uwe> wrote in message
news:5f4559d0d2608@uwe...
> I've decided to create the filter in the form, rather than a separate
> module.
> After reading the threads, it's apparent that it's better to use the Where
> condition in DoCmd.OpenReport, rather than the Filter.
>
> The problem I'm having now is that even hardcoding the where, the report
> doesn't filter for the desired results.
> strReportWhere = "qryFillingDetailReport!ProductID = 'AMP'"
> DoCmd.OpenReport "rptFillingDetail", acViewPreview, , strReportWhere
>
> All product codes are reported.
>
> And, yes, there are records where ProductID = 'AMP'.
>
> Eventually, I want to replace the hardcoded AMP with the table and
> ProductID
> the user selected.
>
> Any help would be appreciated. Thanks.
> Douglas J Steele wrote:
>>It would probably be a little easier to name the table
>>"tblProductSelectFilling" & Format(Time(), "hhnnss")
>>
>>That having been said, you can change the RowSource for your form to use
>>the
>>table name you pass to it.
>>
>>> I have a form which collects parameters to run a report. One of the
>>> parameters collects a list that populates a table. I wanted to make the
>>> list

>>[quoted text clipped - 9 lines]
>>> I can pass the name of the table to the module that creates the filter,
>>> but
>>> how do I use that varible to reference the value in the table?

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200604/1



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing form's text box from Module Elmo Watson Microsoft Dot NET Framework Forms 2 7th Jan 2007 05:05 AM
I dragged an SQL table onto a form, it works, but where is the Open() method being called? Unemployed Programmer Microsoft ADO .NET 1 6th Jun 2005 07:49 AM
Can an event on a form be called from a module? BobV Microsoft Access VBA Modules 3 19th Oct 2004 03:49 PM
Accessing form from module =?Utf-8?B?TXVzdGFmYQ==?= Microsoft Dot NET 1 5th Jul 2004 11:35 AM
Re: How use debug in module called by Form Open event ? Marc Microsoft Access Getting Started 0 27th Mar 2004 12:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.