John Clark
John.Clark at niagaracounty.com
Thu Aug 24 12:38:59 CDT 2006
Well, yeah, I knew WHAT it was doing, but I am a little confused as to why. I think I am doing the same thing in one case as the other, but getting different results. It isn't even a case of different forms. I am using the same form, it is just a different field, which works differently from the rest. I guess what I'll do is, as you suggested, explicitly set the focus, where it is needed. I'm just really self conscious about code like this. I'm always thinking about the person coming along after me, and what it looks like to them. Thanks though! John W Clark >>> "JWColby" <jwcolby at colbyconsulting.com> 8/22/2006 5:14 PM >>> 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com