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

DLookup Function - Microsoft Access97

Status
Not open for further replies.

scroce

MIS
Nov 30, 2000
780
US
Hello - I have been reading up on this function, but I have run across some syntax that I don't quite understand, here it is:

Let's say this is in a textbox called "txtMyText"

=IIf(DLookUp("[OrigPro-RatedPremium]","PaySchedule","[AccountID]=" & [AccountID] & " AND [Year] = '" & [Year] & "'") Is Not Null,DLookUp("[OrigPro-RatedPremium]","PaySchedule","[AccountID]=" & [AccountID] & " AND [Year]='" & [Year] & "'"),DLookUp("[EstPremium]","PolicyPremiums","[AccountID]=" & [AccountID] & " AND [Year] = '" & [Year] & "' AND [PayPeriodID]=1"))

Specifically I am having trouble understanding what the "&" is doing as well as the "AND" statement.

I know that "&" generally signifies a concatenation, and that "AND" usually limits criteria in a query search.

That being given. Could somebody help translate, especially this part:

DLookUp("[OrigPro-RatedPremium]","PaySchedule","[AccountID]=" & [AccountID] & " AND [Year]='" & [Year] & "'"),

which i think says something like "OK, look in a field called [OrigPro-RatedPremium] in a table called "PaySchedule" where Account ID = (.......and then I get confused....)

If someone could help me understand the (....and then I get confused....) part I'd be grateful.

SteveC.
 
Hi Steve,

There are some good MS Access forums here at Tek-Tips, you might want to have a look there as well.

Having said that:

DLookUp("[OrigPro-RatedPremium]","PaySchedule","[AccountID]=" & [AccountID] & " AND [Year]='" & [Year] & "'"),

It *seems* to translate to following SQL.

Select OrigPro-RatedPremium
From PaySchedule
Where PaySchedule.AccountID = AccountID
And PaySchedule.Year = Year Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top