In my version, the autonumber value is not available on the
BeforeInsert*, but it is on the BeforeUpdate event...it is
also available on the first control's BeforeUpdate and, of
course, AfterUpdate events
* I thought it would be since, in code, you can get it as
soon as you do .AddNew, but I tried that before I posted
previously and it doesn't apparently work the same way with
the form event -- kinda makes sense though, since it is
before the record is inserted
'~~~~~~
creating a continuous form with checkboxes to pick products
To add on to what Graham said about the form setup.
Handling the records in a continuous subform is, of course,
the way to go. Another thing I often like to do is
something like this:
subform RecordSource:
SELECT pp.projectID, pp.productID,
p.productname, p.productshortname,
p.productcategory,
IIF(isnull(pp.productID),false,true) as chkUsed
FROM tbl_projectproducts as pp
RIGHT JOIN tbl_products as p
ON pp.productID = p.productID
WHERE pp.projectID = forms!mainform!projectID
OR pp.projectID Is Null
chkUsed will be a checkbox at the beginning of each row.
Every product will be listed and the ones that are actually
records in tbl_projectproducts will be checked.
The form itself will not be updateable, but you can use the
click event of the checkbox to append or delete records from
tbl_projectproducts and then requery the form
I am not quite sure about the SQL since I didn't test it --
you may need to make a couple of adjustments
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10852
Warm Regards,
Crystal
Microsoft Access MVP 2006
*
Have an awesome day
remote programming and training
strive4peace2006 at yahoo.com
*
Graham Mandeno wrote:
> Hi Millie
>
> The autonumber value should be created and assigned the moment you begin to
> create a new record. You don't need to wait until it is saved. The earliest
> you can get it then is the form's BeforeInsert event.
>
> The most common way to handle a setup like this is with a form and subform.
> The form is bound to tbl_projects and the subform to tbl_projectproducts.
> The subform should be continuous and needs to contain only a combo box bound
> to productID, with its RowSource based on tbl_products. Set both the
> LinkMasterFields and LinkChildFields for your subform control to projectID.
>
> Then you can add a new project and select associated products, all from the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10852
> one form.