What I did was to have a subform which was originally based on a given
table - get all the fields, etc. Then I just delete the Recorsource
from the subForm's Recordsource property. Note: you don't need to
delete the field references in the form, like txtName is bound to
fieldName in your table. Just delete the Recordsource.
Then in the Mainform use code like this:
Me.yourSubForm.Form.RecordSource = "Select * From yourTbl Where
someCriteria = 'something'"
Another option is to instead of using a MakeTable Query to use an Insert
Into Query. That gets around locking issues with the MakeTable query.
The only catch is that you have to remove all the old data first. But
that is very easy:
DoCmd.RunSql "Delete * From yourDataTbl"
Then
DoCmd.RunSql "Insert Into yourDataTbl(fld1, fld2,...) Select * From
SourceDataTbl Where someCriteri..."
Just make sure that you have the same number of fields in the Sql
Statements as you do in the Subform and they are the exact same datatype
between the form fields and the fields in the Sql Statement, ie, text
field <-> string field, Date field<->date field in the sql Statement,
Number field<->number field in the sql statement, etc.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!