Putting data into a subform on dirty and making a subform visibleand invisivle

B

Brant

Two Questions

1. I have a customer entry form where an ID is entered and I want to
enter it into an audit form which i have as a subform but i want to put
letters infront of the ID denoting the type of audit but also be able to
do it different times for different types of Audits; For example
CID 123 then I want to automatically enter on dirty NE123, SE123, and
B123 into the subform (making 3 different entries) How can this be done?

2. I want to make a button that when clicked can make a subform visible
or invisible. Is this possible?

Thanks in Advance
 
S

Steve Schapel

Brant,

To get the easy one out of the way first... On the Click event of the
button, code like this:
Me.NameOfSubformControl.Visible = False

As for the Audits records, I would recommend not doing it quite like you
suggested. I think you should keep the CID as a CID, and have a
separate field (AuditType?) in the Audits table for the NE, SE, and B
entries. You can always concatenate these two pieces of data together,
using a query or in the control source of a textbox on a form or report,
whenever you need it for display purposes, but they should really be
stored separately at the table level. You can use an Append Query to
add the 3 records to the Audits. If you had a simple table named
AuditTypes, one field called AuditType, with 3 records denoting NE, SE,
and B, then your code for entering the subform records could be
something like these lines...
CurrentDb.Execute "INSERT INTO SubformTable ( CID, AuditType )" & _
" SELECT " & Me.CID & ", AuditType FROM AuditTypes", dbFailOnError
Me.NameOfSubfrom.Requery
 
Top