Page 1 of 1

Pulling master-form data into a browse subform

Posted: Thu Jan 10, 2013 8:10 am
by jmusther
I have a form which displays client information. I have added a browse subform which shows data from a table holding information about important dates associated with that client.

My two tables are therefore:
clients (for which the primary key is id)
dates (for which the primary key is id, and which contains the foreign key clientid)

My browse subform uses the SQL:
SELECT * FROM dates WHERE clientid = #id#

This works well.

When it comes to creating a new record in the subform however, I need to automatically fill in the client id for the client currently being viewed in the master form. This way, any new record created from this browse subform will be associated with the correct client.
The only way I can find to do this is the have the default filter for the browse subform set to #id#, and then use the the following to automatically fill in the 'clientid' field once the edit form is opened:
SELECT #browse_filter#

The above does work, but it seems a little messy, is there a cleaner way to do this?

Thanks in advance.

Re: Pulling master-form data into a browse subform

Posted: Mon Jan 14, 2013 3:44 am
by admin
jmusther,

Using #browse_filter# is the way to do it.

Steven