JWColby
jwcolby at colbyconsulting.com
Tue Aug 22 16:14:48 CDT 2006
It appears that the form just opened does not have the focus, thus since the focus is in the current form, it can't be hidden. Open the new form modal, or explicitly set the focus into the new form just opened, then do the hide. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Clark Sent: Tuesday, August 22, 2006 4:37 PM To: Access Developers discussion and problem solving Subject: [AccessD] Should be simple I am working on a DB that I am trying to finish up. I've shown it to the users and they like it, but of course there are a few alterations to be made. A couple of them are actually just things I overlooked. I have a form where defendants are entered into a system. Actually, it is all names associated with a case (i.e. lawyers, judges, victims, defendants, etc.) and the system sorts them out by their check box designations on entry or edit. I have a drop-down box in place to choose a lawyer...same w/many of the fields, but I'll use lawyer here. I used a union query to place a "<CREATE NEW ENTRY>" option, at the top of the drop-down. If the user clicks on this option, they are taken to the form to enter new names, and the default check is placed, depending on where you came from (I use OpenArgs for this). It also knows where to go back to. The code used for this is: ____________________________________________________________________________ ________ Private Sub txtAttorney_BeforeUpdate(Cancel As Integer) If txtAttorney.SelText = "<ENTER NAME>" Then DoCmd.OpenForm "frm_Subjects", acNormal, , , acFormAdd, acWindowNormal, "ATT" Me.Visible = False End If End Sub ____________________________________________________________________________ ________ However, I have tried adding the same ability to the "Charges" field, and the last liine gives me trouble. It says, "You can't hide a control that has the focus." I know what this means, but I just copied the code from elsewhere in the same program, and it works there. Any ideas? John W. Clark -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com