SelStart Error - Run-time 2185

I have been using input masks for dates on forms.  I usually add code to 
force the cursor to the beginning of the text box using SelStart.

Private Sub txtDate1_GotFocus()
    Me.txtDate1.SelStart = 0
End Sub

I created a form and the above field functioned fine.  After I added more 
controls and code I began to get a Run-time 2185 error -You can't reference a 
property or method for a control unless the control has the focus.

Anyone know what causes this or is my form corrupted in some way?

Thanks in advance for any help or insight,
-- 
Scott S
0
Utf
11/8/2007 10:40:00 PM
access.formscoding 7493 articles. 0 followers. Follow

4 Replies
1503 Views

Similar Articles

[PageSpeed] 38

Scott, the only case that comes to mind is where:
- You have a form that contains no records, and
- No new records can be added.

In this case, the detail section goes completely blank. Any controls in the 
Form Header or Form Footer sections still show, but Access gets confused and 
can show this error message. More info in the first section of this article:
    http://allenbrowne.com/bug-06.html

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ScottS" <ScottS@discussions.microsoft.com> wrote in message
news:370B1D17-32A9-4D72-BF64-76D8F3ADC207@microsoft.com...
>I have been using input masks for dates on forms.  I usually add code to
> force the cursor to the beginning of the text box using SelStart.
>
> Private Sub txtDate1_GotFocus()
>    Me.txtDate1.SelStart = 0
> End Sub
>
> I created a form and the above field functioned fine.  After I added more
> controls and code I began to get a Run-time 2185 error -You can't 
> reference a
> property or method for a control unless the control has the focus.
>
> Anyone know what causes this or is my form corrupted in some way?
>
> Thanks in advance for any help or insight,
> -- 
> Scott S 

0
Allen
11/9/2007 1:42:41 AM
"You can't reference a property or method for a control unless the control
has the focus."

So Access is saying that you're trying to do something to ControlA that you
can only do when ControlA has focus, and ControlA doesn't have focus! 

One possibilty that comes to mind, especially when you speak of adding
multiple controls and using the identical code on all of them, is that you've
copied and pasted code and forgotten to change the control name in the code.

Say you start with 

Private Sub txtDate1_GotFocus()
   Me.txtDate1.SelStart = 0
End Sub

then you add a new field, txtDate2. You copy and paste the above sub, and
change txtDate1 to txtDate2 in the sub title, but forget to do so in the body
of the sub, so that you end up with this

Private Sub txtDate2_GotFocus()
   Me.txtDate1.SelStart = 0
End Sub

Now, when txtDate2 gets the focus, you're trying to set SelStart for txtDate1,
and you'll get your 2185 error message. .

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via http://www.accessmonster.com

0
Linq
11/9/2007 4:17:01 AM
Thanks Allen.  You absoultely nailed this one and without your help there is 
no way I would have found it.

The fields in question were in my form header.  The detail section was not 
displaying records as you pointed out.  When I removed the record sources, 
the SelStart worked as it should.

I will have to figure out a way to work around this problem.

Thanks again!
-- 
Scott S


"Allen Browne" wrote:

> Scott, the only case that comes to mind is where:
> - You have a form that contains no records, and
> - No new records can be added.
> 
> In this case, the detail section goes completely blank. Any controls in the 
> Form Header or Form Footer sections still show, but Access gets confused and 
> can show this error message. More info in the first section of this article:
>     http://allenbrowne.com/bug-06.html
> 
> -- 
> Allen Browne - Microsoft MVP.  Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
> 
> "ScottS" <ScottS@discussions.microsoft.com> wrote in message
> news:370B1D17-32A9-4D72-BF64-76D8F3ADC207@microsoft.com...
> >I have been using input masks for dates on forms.  I usually add code to
> > force the cursor to the beginning of the text box using SelStart.
> >
> > Private Sub txtDate1_GotFocus()
> >    Me.txtDate1.SelStart = 0
> > End Sub
> >
> > I created a form and the above field functioned fine.  After I added more
> > controls and code I began to get a Run-time 2185 error -You can't 
> > reference a
> > property or method for a control unless the control has the focus.
> >
> > Anyone know what causes this or is my form corrupted in some way?
> >
> > Thanks in advance for any help or insight,
> > -- 
> > Scott S 
> 
> 
0
Utf
11/9/2007 2:22:00 PM
Thanks for your help with this.  I checked my code and it was correct, but 
problem you pointed out to me did happen to me in the past so it was well 
worth checking it out.

Thanks for your help.
-- 
Scott S


"Linq Adams via AccessMonster.com" wrote:

> "You can't reference a property or method for a control unless the control
> has the focus."
> 
> So Access is saying that you're trying to do something to ControlA that you
> can only do when ControlA has focus, and ControlA doesn't have focus! 
> 
> One possibilty that comes to mind, especially when you speak of adding
> multiple controls and using the identical code on all of them, is that you've
> copied and pasted code and forgotten to change the control name in the code.
> 
> Say you start with 
> 
> Private Sub txtDate1_GotFocus()
>    Me.txtDate1.SelStart = 0
> End Sub
> 
> then you add a new field, txtDate2. You copy and paste the above sub, and
> change txtDate1 to txtDate2 in the sub title, but forget to do so in the body
> of the sub, so that you end up with this
> 
> Private Sub txtDate2_GotFocus()
>    Me.txtDate1.SelStart = 0
> End Sub
> 
> Now, when txtDate2 gets the focus, you're trying to set SelStart for txtDate1,
> and you'll get your 2185 error message. .
> 
> -- 
> There's ALWAYS more than one way to skin a cat!
> 
> Answers/posts based on Access 2000
> 
> Message posted via http://www.accessmonster.com
> 
> 
0
Utf
11/9/2007 2:24:02 PM
Reply:

Similar Artilces:

ExMerge 'Error configuring message service'
Hi All, I am running into this error when trying to import a PST into Exchange 2003 SP1 (on SBS 2003): Error configuring message service (MSPST MS) (MAPI_E_EXTENDED_ERROR) (CMapiSession::CreateEMSPSTProfile) I know this matches a KB article exactly, but the PST is NOT read only (I have even made it read only and then not read only just to make sure). I am pretty sure I have correctly removed deny send and receive as. I can export to a PST from the mailbox in question and then re-import the exported PST. The mailbox does not have any limits and does have messages so it is initialize...

stack fault error when browsing address book
I have a problem that occurs when browsing the address book "Contacts" that results in the error message: OUTLOOK has caused a stack fault in MSPST32.DLL and the termination of Outlook I've updated the Win98Se and the Office 2000, tried the steps in the KB218853, and searched the newsgroup and KB to no avail. Also tried the Inbox repair tool (scanpst.exe) which found only minor problems and repaired them. I can look at the entire "Contacts" folder in Outlook without problems. This does not appear to be related to any contact record. Thanks Steve ...

Should be Easy Time Date Issue
I dont mean to insult anyones intelligence, but I am new to Excel. would like to double click a cell and have the current PC time and dat to enter the cell. Is this possible? Thank you -- RubberSou ----------------------------------------------------------------------- RubberSoul's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1678 View this thread: http://www.excelforum.com/showthread.php?threadid=31983 How about... Shift-Ctrl-; (Hold down the Shift key and the Ctrl key, then press the semi-colon key) This enters the time. Then format the cell for Date/Tim...

Slow Response time after server move to AD
I've recently moved my Windows 2003 Server running GP 8.0 from a stand alone server on a Novell network to a member server in Active Directory. The response time from client computers has slowed drastically. It also ocurred when the clients were part of Active Directory and the sevrer was still a stand alone (workgroup). Does anyone have any thoughts on what might be slowing the response time of GP, primarily on customer screens. Thanks! Ben DeGennaro ...

Problems with reading date/time format from SQL server
Helo! I made a pivot table. I get data from external source - SQL server. On of the columns is date/time type. For some reason unknown to me, Exce doesn't read this dates correctly. Instead of dots between months an days it puts little squares .. ?!? I opened the same file on m coworkers comp. and it works just fine. If anyone has already encountered this and knows how to fix it .. plase reply. thnx j -- Message posted from http://www.ExcelForum.com There may be some difficulties getting external data properly into Excel. If not done correctly you cannot use the data in formulae e....

Case select returning error when cell contains #N/A : how must i avoid this error
Title says it all Thanks, Luc maybe this will do what you want Sub test() If Not IsError(Range("C1").Value) Then Select Case Range("C1").Value Case 1 MsgBox "1" Case 2 MsgBox "2" End Select End If End Sub -- Gary Keramidas Excel 2003 "Luc" <lferr@live.be> wrote in message news:7AB07996-F1EE-41C1-8D9D-8A7DA54CED91@microsoft.com... > Title says it all > > Thanks, > > Luc Thanks for your help !!!!! Luc "Gary Keramidas" <GKeramidasAtMSN.com> schreef in berich...

Error Code: 0x8024D007
Hi all: I have tried pretty much evrything listed here in other discussions. It appears that my last update was January 2010. I am running XP sp3. I would hope by now Microsoft would have a general fix for WUS issues. I know this is a compllex issue but so many people can no longer get updtaes. is this their way of trying to force us all to Win 7? Any help would be appreciated. Thx Michael Michael, The most common cause of error 0x8024D007 is that registry files that correspond to the Wups2.dll file are missing. However, the problem can also be caused by other mis...

power point error
get the following error when double clicking a slideshow in Outlook: Procedure entry point GetProcessImageFileNameW could not be located in the dynamic link library. PSAPI.DLL Originally I thought it could be a problem with PowerPoint 2007 so I had Unistalled the Office suite and reinstalled it however the problem still arised. Even repairing the Office suite did not help. I tried using the sfc /scannow but to no avale. I also tried renaming the PSAPI.DLL to PSAPIOLD.DLL rebooted the machine and then it created a new PSAPI.DLL file. Still the error arises. Then I had tried repar...

Error C2440 cannot convert from void
I got this error a few days ago and after much searching and still stuck on the problem. Any help given will be greatly appreciated. Error 1 error C2440: 'static_cast' : cannot convert from 'void (__thiscall CPage1::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' The error occurred in this code: BEGIN_MESSAGE_MAP(CPage1, CPropertyPage) //{{AFX_MSG_MAP(CPage1) ON_WM_DESTROY() ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON_PROV_ADD, OnButtonProvAdd) ON_BN_CLICKED(IDC_BUTTON_PROV_EDIT, OnButtonProvEdit) ON_BN_CLICKED(IDC_BU...

Conversion Errors Table
Hello, I'm new to working with Access, I just converted an Access 97 databas into Access 2002. It tells me there were errors, and to look at th Conversion Errors Table. But nowhere in the message or in the MS Hel is there anything telling me where to find this table. Can someon help? Thanks Patric -- psha ----------------------------------------------------------------------- pshaw's Profile: http://www.officehelp.in/member.php?userid=493 View this thread: http://www.officehelp.in/showthread.php?t=125029 Posted from - http://www.officehelp.i I'd expect to find it in the new...

Outlook Still Running
I am running XP Pro with Office 2003 Pro and sometimes when I exit out of Outlook, Outlook.exe and Winword.exe stay as processes still running. Does anyone else have this problem and what can do to make sure this does not happen? Thanks for your help -- Neil Remove ABCD from Email address to reply <neil154ABCD@earthlink.net> wrote: > I am running XP Pro with Office 2003 Pro and sometimes when I exit > out of Outlook, Outlook.exe and Winword.exe stay as processes still > running. Does anyone else have this problem and what can do to make > sure this does not happ...

time formula question
This formula works great if the ending time is before 0:00. =IF(D21>0,B21/INDIRECT("Sheet1!E"&MAX((A21>=$C$9:$C$11)*(A21<=$E$9:$E$11)* {2;3;4})),"") $C$9:$C$11 is my starting time i.e. 20:00 $E$9:$E$11 is my ending time i.e. 04:30 How can I get this to work if A21 = 20:15? TIA, David Try this: =IF(D21>0,B21/INDIRECT("Sheet1!E"&MAX((($C$9:$C$11<$E$9:$E$11)*(A21>=$C$9:$C$11)*(A21<=$E$9:$E$11)+(($C$9:$C$11>=$E$9:$E$11)*((A21>=$C$9:$C$11)+(A21<=$E$9:$E$11)))*{2;3;4})),"") HTH -- AP "David" <dfizer@r...

run Microsoft Publisher 2002 macro in command line
This might look simple but I cannot figure it out. How can you run a Microsoft Publisher 2002 macro in command line? (like in Word, you can do winword file.doc /mNAMEOFTHEMACRO ) In a command line I am not sure. Try posting at microsoft.public.publisher.programming Brian Kvalheim Microsoft Publisher MVP http://www.kvalheim.org >-----Original Message----- >This might look simple but I cannot figure it out. > >How can you run a Microsoft Publisher 2002 macro in command line? >(like in Word, you can do winword file.doc /mNAMEOFTHEMACRO ) >. > ...

time line in chart
Hi How do I put a vertical line in a chart in excel at a given point? i.e. timeline Thanks Jon I know this is too elementary, but go from here: You have a scatter chart from A1:B6 (X A1:A6; Y B1:B6) 10 3 11 4 12 5 13 6 14 7 15 8 A 2nd source series is A8:B9 (X A8:A9; Y B8:B9) 13 0 13 6 giving you the a vertical line at X=13. "jon" <jon@nospam.com> wrote: >Hi >How do I put a vertical line in a chart in excel at a given point? i.e. >timeline >Thanks >Jon ----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.prone...

Error Msg.
Can anyone decipher this error message: DVZMSGR caused an invalid page fault in module MSVCRT.DLL at 0167:78001296. Registers: EAX=00650078 CS=0167 EIP=78001296 EFLGS=00010202 EBX=0075000c SS=016f ESP=0063f728 EBP=0063f748 ECX=0064fc40 DS=016f ESI=0000003f FS=393f EDX=00650448 ES=016f EDI=0000003f GS=0000 Bytes at CS:EIP: 89 4c 11 fc 8b 75 f0 03 d1 8d 4e 01 89 0a 89 4c Stack dump: 00000000 00000040 780013d0 816d0238 00000050 006503c0 0064fc40 00000001 0063f77c 7800145c 0075000c 00000000 ffffffff 780013d0 bff7b9c5 816d0204 ...

outlook 2000 running under windows xp
Having recently received automatic updates for windows xp, outlook 2000 hangs on sending/receiving emails, is this a known problem ? I'm not aware of problems. Do you get any error messages? I'd try deleting the *.srs file. It's located at %USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlo...

Default reminder time on tasks
Does anybody know if there is anyway to change the default reminder on the tasks window when it comes up to remind?? It currently is at 5 minutes and I have some users who'd like that to be a little longer because after they tell each task to remind them in an hour, once the hour is up it defaults back to 5 minutes. Any help would be greatly appreciated!! Sorry, but the default snooze time value is hard-coded and cannot be changed. -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my e-mail address will probably not be answered -- please reply only to the newsgroup to preser...

Money 2004 Deluxe Start error after install
After a fresh install of Money 2004 Deluxe in Windows XP Home I get an error box that says "Microsoft Money has encountered an error and needs to close" There is a box checked that says " Restart Microsoft Money" but it never restarts. Th error signature - AppVer: 12.0.0.613 Mod Name: kernel32.dll Offset: 00013887 Under technical information - Exception information Code: 0xe06d7363 Flags: 0x00000001 Address: 0x0000000077e73887 Is this a Windows error or did I waste my money on a software package. Please help - thanks In microsof...

Already running
I read an HTML page that offered a solution to the problem were Money 2006 will not close and remains an active process. The solution offered was to invoke the Automatic backup routine and the fact that the dialogue box appears will cure the problem. This does not work for me in Money 2006. He also stated that Money being stuck will not consume any CPU time. Wrong again. -- Regards, Stephen Kaloroplos Is there a question in there somewhere? "Stephen" <eubie@bellsouth.net> wrote in message news:%23WUHusV9GHA.4620@TK2MSFTNGP02.phx.gbl... >I read an HTML page that...

Help Needed With Write Conflict Error Message.
I have an order form that users open and close on a regular basis. The form is based on a query. On the form are two fields, "TicketPrinted" and "RevisedDate". Most of the time the field "Ticket Printed" has a value in it of "Yes". What I want to be able to do is that if a date is entered into this "RevisedDate" field, OR if the information is changed in this "Revised Date" field, that when the user closed the form, an update query runs that changes the "TicketPrinted" field from the original value of "Yes"...

XmlValidatingReader unbelievable error
Hi everyone, I am trying now for 4-5 hours to write a simple code to validate a very simple XML and i still get an error. Here is my Code, and i always get an error at args.Exception ("The 'urn:books:catalog' element is not declared. An error occurred at file:///c:/inetpub/wwwroot/LakisService/books.xml, (2, 2).") private void Button2_Click(object sender, System.EventArgs e) { XmlTextReader r = new XmlTextReader(Server.MapPath("books.xml")); XmlSchema xs = new XmlSchema(); xs.SourceUri = Server.MapPath("books.xsd"); XmlValidatingReader v = new X...

An error number : 424 problem
I'm having trouble with an attachment field. On a report I can see the picture and the filename of the selected attachent properly. Now in a SQL UPDATE string that i'm making I always get the error 424 Object required. Here is the line where it happens : 'mySQL = mySQL + ", scan_g = " & prn_du_pied_g.FileName scan_g is a Text field prn_du_pied_g is an attachment All I want to do is to use the filename of the attchment. How do I solve this Thank you for the help -- Eric "ericb" <eric@b.com> wrote in message news:9A...

replace error by value
Hi, Can anyone tell me how I can change an error msg (f.e. #DIV/O!) by any value ? I have a formula that generates an error msg, but I want to change it by ZERO. Thanks, Fabian =IF(ISERROR(your_formula),0,your_formula) HTH Jason Atlanta, GA >-----Original Message----- >Hi, > >Can anyone tell me how I can change an error msg (f.e. >#DIV/O!) by any value ? > >I have a formula that generates an error msg, but I want >to change it by ZERO. > >Thanks, >Fabian >. > Hi change your formula to something like =IF(B1=0,0,A1/B1) -- Regards Frank Kabel Fra...

Business Portal Error During Installation
Hi, I am trying to install Business Portal 2.0, I have prepared a Share Point Server with windows 2003 installed, but when I try to install Business Portal it si giving me this error message "The database (Comany ID) on SQL Server (Server Name) does not meet minimum requirements-your back office data must be at vesion 7.x" although our Great Plains version is 7.5 with service pack 1 installed. Any suggestions about this issue will be highly appreciated. Mohammad, Thanks for using the newsgroup. I have seen this error before. In the cases I saw it, it was due to incorrect d...

Crystal Logon Error 05-18-05
I am having major problems trying to get Crystal to work (and it's my last thing)! When trying to access the reports I get the logon error message. I've been through the posted messages and tried pretty much everything. (Services, NT Authority etc). If I go into the Crystal Configuration manager and enable servers they are in there as not enabled. Selecting enable all then gives me this message; your license key is invalid or has expired. If you received a temporary license key by purchasing another crystal product you must register Crystal Enterprise to receive your permanent l...