Hi

I have the following code on the before insert action of a subform on FrmProperty and frmPurchaser1

Dim varsalesid As Variant
Dim strlogon As String

'Find logon information
strlogon = Environ("Username")
varsalesid = DLookup("[SALESID]", "tblsalesman", "Winlogon=" & Chr(34) & strlogon & Chr(34))
varviewing = DLookup("tblProperty![ViewingType]", "tblProperty", "Propertyid =" & Parent!PROPERTYID)

'If we find the one enter it
If Not IsNull(varsalesid) Then
SALESMANID = varsalesid
End If

Me!CREATDATE = Date

If varviewing = "Accompanied Vendor Access" Then
Me.AVIEW = True
End If

If varviewing = "Key Accompanied" Then
Me.AVIEW = True
End If

If varviewing = "Key Accompanied Inform Vendor" Then
Me.AVIEW = True
End If

what i want to also be able to do is lookup in another form called 'frmPropertyDetails' on the current frmProperty or frmPurchaser1 or even a table called tblpropertydetails

We use the form to decide properties the purchaser want to view or purchasers who want to view the property. However want to lookup in the tblpropertydetails if the details for that particular property have been given to the purchaser as that viewing should be attributed to the person who sent the details, not enetered the viewing.

TblProperty Setup

PropertyId
etc
etc

tblpurchaser
PurchID
etc
etc

tblViewings
ViewingID
PropertyID
PurchID
SalesID
etc
etc

tblPropertyDetails
PurchID
SalesID
PropertyID
DetailsID
etc

any ideas on where the code should be?