Robert Gracie
Subscriptions at servicexp.com
Sun Mar 21 12:01:58 CST 2004
>The recordset for the "frmPeopleV4" form doesn't include displayed fields. >This one I don't understand. The SQL behind the form did not include all of fields referenced on the form so and when you selected a company name, you would get ?NAME error in the fields. >And the class "dclsCtlTextBox" includes Reference to the label "mlbl" variable in the exit and enter events that are not being Initialized (set). >This was to demo the disconnected label. I set an On Error Resume Next in >front if that code to handle where there is on label. Not in the version I downloaded. any movement in any field would produce a Object not set error >This stuff will come back out for V5, it was just a demo of what is >possible. Real cool stuff!!! John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Robert Gracie Sent: Sunday, March 21, 2004 10:22 AM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Framework Discussion - Disconnected labels John, Your demo has some problems.. The recordset for the "frmPeopleV4" form doesn't include displayed fields. And the class "dclsCtlTextBox" includes Reference to the label "mlbl" variable in the exit and enter events that are not being Initialized (set). I presumed that these references are in error. I Commented them out, fix the recordset and all seems to work like a charm..... Robert Gracie www.servicexp.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Saturday, March 20, 2004 10:36 PM To: AccessD Subject: [AccessD] Framework Discussion - Disconnected labels BTW it is possible to add controls to a control's control collection. Thus you can "TELL" a control in a continuous form that a label in the form's header belongs to it. I add a function to the class which assigns a label out on the form to that control: ' 'Connects a label to a combo - used for continuous forms where the label is in the header etc. ' Function ConnectLabel(llbl As Label) On Error GoTo Err_ConnectLabel Set mlbl = llbl Exit_ConnectLabel: Exit Function Err_ConnectLabel: MsgBox Err.Description, , "Error in Function dclsCtlTextBox.ConnectLabel" Resume Exit_ConnectLabel Resume 0 '.FOR TROUBLESHOOTING End Function Then, strictly for demo purposes I set and reset the label's backcolor in the text boxes OnEnter and OnExit: ' 'These are the event stubs for the control's OnEnter and OnExit events ' Private Sub mtxt_Enter() mlngBackColorOrig = mtxt.BackColor 'When we enter the text box, save the original back color mtxt.BackColor = mclngBackColor 'Set the back color to our favorite color mlbl.BackColor = 16744448 mlbl.BackStyle = 1 End Sub Private Sub mtxt_Exit(Cancel As Integer) mtxt.BackColor = mlngBackColorOrig 'When we exit the control, set the back color back to the original color mlbl.BackStyle = 0 End Sub In the form's Open event, after initializing the framework I call this method and pass in a lable: Public fdclsFrm As dclsFrm Private Sub Form_Open(Cancel As Integer) Set fdclsFrm = New dclsFrm fdclsFrm.Init Me, Me With fdclsFrm.colClasses .item("txtCode").ConnectLabel lblCode .item("txtName").ConnectLabel lblName End With End Sub To see this functionality open the lfrmState and tab through the two columns. Again, this isn't particularly useful in this instance but it might be a helpful indicator of cursor movement or state of a control and again demonstrates that a disconnected label can be added to a control's control class. John W. Colby www.ColbyConsulting.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com