View Single Post
  #100 (permalink)  
Old 03-21-10, 03:43
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Unbound form example (basic)

Here's a very basic example of an unbound form and code to write to/from the form. There are different techniques and this is only one of many (written in ADO code).

I had some problems with it erroring in MSAccess 2003 (it may be due to me having both 2003 and 2007 on the same computer) but it works fine in 2007.

You'll need to look at the Module: Customer Functions to see the functions which do the actual writing/retrieving/updating of the data. I reference the form directly in these functions but there are other ways.

If you're embedding a subform (such as a continuous one), I'd set this subform bound to the relational table (with criteria in the recordsource so CustomerID = Forms!CustomerForm!CustomerID) and then issue a Forms!CustomerForm.requery in the appropriate functions after the record has been retrieved. Creating unbound continous subforms gets a bit involved if they are continuous. Otherwise you could use the same principles as above for the Customerform if it's a single form (ie. Forms!CustomerForm!CustomerFormSub!CustomerID = rs!CustomerID, etc...etc... for your subform field names).
Attached Files
File Type: zip UnboundFormExample.zip (27.1 KB, 96 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 03-21-10 at 03:52.
Reply With Quote