Reference data from an unopened table
am 20.11.2007 21:32:33 von Ondernemer
THis may be an obvious question and I'm just having a brain cramp. If so...
Otherwise, I want to reference data from an unopened table. I have a table
set up named CompanyConstants which contains information such as default
hourly rates, the company address, logo file etc. I want to be able to
reference the data in this table from forms & reports in my database. For
example, I have an estimate form where employees enter information about a
job to create an estimate. One of the fields from the Estimates table/form
is HourlyRate. What I am looking to have happen is, with the OnEnter event,
Access looks in the CompanyConstants table for the default hourly rate and
plugs that in as the value for HourlyRate in the Estimate tables. I can't
seem to include the CompanyConstants table in Estimates control source. When
I try, I can't edit any data in Estimates.
IF this needs clarification, let me know (it makes perfect sense as I type
but that doesn't mean much.) and I'll try to explain it better.
Re: Reference data from an unopened table
am 20.11.2007 22:59:15 von Rich P
Hi Kevin,
In your estimates table I will assume you have fields something like the
following:
Criteria HourlyRate
plumbing 45
doors 35
windows 50
...
In your form, when a user enters some criteria in a criteria field -- it
is in the AfterUpdate event of that textbox (the criteria textbox) where
you get the hourly rate from your estimate table and populate the
HourlyRate textbox
Private Sub Criteria_AfterUpdate()
txtHourlyRate = DLookUp("HourlyRate", "Estimate","Criteria = '" &
txtCriteria & "'")
End Sub
Look up DLookUp function in the Access HelpFiles for more information.
Rich
*** Sent via Developersdex http://www.developersdex.com ***
Re: Reference data from an unopened table
am 21.11.2007 01:33:43 von Ondernemer
I think you have the jist of what I was asking. That being said, DLookup was
exactly what I was looking for. Thanks a million!
Kevin
"Rich P" wrote in message
news:474358b3$0$509$815e3792@news.qwest.net...
> Hi Kevin,
>
> In your estimates table I will assume you have fields something like the
> following:
>
> Criteria HourlyRate
> plumbing 45
> doors 35
> windows 50
> ...
>
> In your form, when a user enters some criteria in a criteria field -- it
> is in the AfterUpdate event of that textbox (the criteria textbox) where
> you get the hourly rate from your estimate table and populate the
> HourlyRate textbox
>
> Private Sub Criteria_AfterUpdate()
> txtHourlyRate = DLookUp("HourlyRate", "Estimate","Criteria = '" &
> txtCriteria & "'")
> End Sub
>
> Look up DLookUp function in the Access HelpFiles for more information.
>
>
> Rich
>
> *** Sent via Developersdex http://www.developersdex.com ***