Displaying text depending on the value of a field
I got 3 tables.
Table(A) holds a unique identifier and a description field. I would like to display the description field in a form.
However this is depending on the information held on another table(B). If the information in table(B) is null, I would like to display the information found on a third table(C).
[u]Here is the scenario.</u>
My first table(A) holds the names of companies and their unique identifiers. The second table holds information of divisions within an organization. The third table(C) holds information on the organizations. I need to know who I should charge, the head office (organization) or the divisions themselves. So if no info exists on the second table(B) -division- then I want to charge by default the Organization table(C) or any third party that has agreed to pay for this organization.
So what I am looking to do is, find who (table(B) or table(C)) and then withdraw the description from table(A) and display it.
I have come up with the following:
Public Function GetAccountingBillTo()
Dim TempNum As Integer
Dim TempName As String
If AccountingBilltoC = "" Then
TempNum = DLookup("[AccountingBilltoO]", "Organizations", "[Name] =" & Customers!OrganizationName)
If TempNum <> "" Then
TempName = DLookup("[sName]", "TblAccountingBillToDropDownInfo", "[tempnum]=" & Organizations!AccountingBilltoO)
Else
TempName=" "
End If
Else
TempName = DLookup("[sName]", "TblAccountingBillToDropDownInfo", "[tempnum]=" & Customers!AccountingBilltoC)
End If
Text179 = TempName
End Function
This however gets me a Run-Time error '424'. Object required.
Help!
[u]Thanks.</u>
[LGuzman]
__________________
[LGuzman]
|