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

Referencing a field in a Subform

Status
Not open for further replies.

dafyddg

Programmer
Dec 2, 2003
92
GB
Hi,

I've got some SQL which i use to populate a list box which is in a subform. The list box has the following SQL as its row source:

SELECT Contracts.ContractID, Contracts.Description, Providers.[Provider Name], Contracts.ClientID FROM Providers INNER JOIN (Clients INNER JOIN Contracts ON Clients.ClientID=Contracts.ClientID) ON Providers.ProviderID=Contracts.ProviderID WHERE (((Contracts.ClientID)=Forms![ClientDetails]![ClientID]));

When i open the sub form by itself it works fine, however when it is openned as a subform, Access asks me tp specify the value of

Forms![ClientDetails]![ClientID]

I assume this is something to do with the way my SQL is referencing th sub form but i can't figure out what.

I've tried using:

Forms![AddEditClients]![ClientDetails]![ClientID]

(AddEditClients is the master form)

But to no avail.

Is there anyway around this problem?


Cheers :)
 
This is the notation for referencing a field on a sub form -

Forms!ParentFormName!SubFormControlName.Form!SubformControlName

HTH,

Steve
 
Ahhh, thank you. That actually makes alot of sense.

I'll give it a go in work tomorrow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top