Access 2003 Error 2108
help? Post your question and get tips & solutions from a community of 418,417 IT Pros & Developers. It's quick & easy. Can setfocus on a field error 2108 P: n/a SDL The code below says error 2108 must save field before setfocus? All I want to do is check out the input field and if in error set the cursor back on it after the MsgBox displays. In this case I read the file and didn't find it. If INVOICE_NBR1 = 0 Then MsgBox "INVOICE NUMBER is not on file. Re-enter or enter NAME or PHONE.",vbOKOnly Me.INV_NBR.SetFocus Any help would be great thanks. Jul 16 '06 #1 Post Reply Share this Question 1 Reply P: n/a Rick Brandt SDL wrote: The code below says error 2108 must save field before setfocus? All I want to do is check out the input field and if in error set the cursor back on it after the MsgBox displays. In this case I read the file and didn't find it. If INVOICE_NBR1 = 0 Then MsgBox "INVOICE NUMBER is not on file. Re-enter or enter NAME or PHONE.",vbOKOnly Me.INV_NBR.SetFocus Any help would be great thanks. Use BeforeUpdate for your validation code and just set Cancel=True if it fails. The control will never lose focus so resetting it is not required. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com Jul 16 '06 #2 This discussion thread is closed Start new discussion Replies have been disabled for this discussion. Similar topics SetFocus does not work in Access form Run Time Error 2110: cant move the SetFocus control SetFocus Issue In Access, how to use SetFocus within the LostFocus procedure (for same control) ACCESS combo box field how can i use setfocus with in the lostfocuse property SetFocus from tab page to main form Problem with SetFocus socket error asp.net setfocus after validation not working Browse more Microsoft Access / VBA Questions on Bytes Question stats viewed: 5668 replies: 1 date asked: Jul 16 '06 Follow this discussion BYTES.COM © 2016 Formerly "TheScripts.com" from 2005-2008 About Bytes | Advertise on Bytes | Contact Us Sitemap | Micros
Custom Search UtterAccess Forums>Microsoft® Access>Access Forms Control Name Required Error 2514 Forum HomeSearchHelpUA Messages|-- UtterAccess.com NewsAccess Knowledge Center|-- Access Code Archive|-- Access Knowledgebase / FAQ|-- Access TutorialsMicrosoft® Access|-- Local Access User Groups (AUGs)|-- Interface Design|-- Access Q and A|-- Access Tables + Relationships|-- Access Queries|-- Access Forms|-- Access Reports|-- Access Macros|-- Access Modules|-- Access Date + Time|-- Access Errors + Error Handling|-- Access Built-in Functions|-- Access Searching + Data Mining|-- Access Records|-- Access Security|-- Access Automation|-- Access Database Container|-- Tool bars, Menu bars + Ribbon|-- https://bytes.com/topic/access/answers/512416-can-setfocus-field-error-2108-a Access Services (Web Databases)|-- Access Data Access Pages (Deprecated)|-- Access Data Projects - ADP|-- Access Runtime, Packaging & DeploymentAnd More...|-- Microsoft SQL Server|-- SQL Server Reporting Services|-- Microsoft SharePoint|-- Microsoft Internet Explorer|-- Visual Basic 6 and Earlier|-- Visual Basic 2003 and Later|-- ASP and VBScript|-- Web Development|-- PHP, Perl, MySQL and Postgres|-- Other Database Engines|-- BI Tools and Applications|-- http://www.utteraccess.com/forum/Control-Required-Error-2-t1483688.html JAVA and C#|-- GraphicsMicrosoft® Office|-- Microsoft Excel|-- Microsoft Excel FAQs|-- Microsoft Word|-- Microsoft Outlook|-- Microsoft PowerPoint|-- Microsoft FrontPage/Exp. Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Q & A - UtterAccess.com Forums|-- Q & A - Access Wiki Options PJTView Member Profile Aug 18 2007, 03:09 PM Post#1Posts: 40Joined: 18-July 07From: South CarolinaHiI am working on an '03 db in the 07' software--I have a form [frmPatientList] that contains a Discharge Date field [fldDCDate] and a checkbox[fldDC] to indicate Discharged Yes/No. I am trying to set an event procedure that - prior to updating the D/C to Yes, checks [fldDCDate] and if that field is Null then gives an error msg and resets the focus to [fldDCDate].I entered my vbacode on my checkbox[fldDC]s ' Before Update' Property as follows:Private Sub fldDC_BeforeUpdate(Cancel As Integer)If IsNull(fldDCdate) Then DoCmd.CancelEvent DoCmd.Beep MsgBox "You must enter a DC/SO Date before making this selection." DoCmd.GoToControl (
Guest I received the following message: Error number: 2108 You must save the field before you execute the GotoControl action, the GoToConrol method or the SetFocus method. The form contains a combo box, HRNum, with the Limit to list property set to No. There is a http://www.pcreview.co.uk/threads/error-number-2108-you-must-save-the-field-before-you.2772624/ sub HRNum_BeforeUpdate which contains the following code to test for a missing HR Number. I know that the Set Focus is causing the error, however, when I used a text field instead of a combo box there was no error and how could I "save the field" as it states in the error. Private Sub HRNum_BeforeUpdate(Cancel As Integer) If IsNull(Me.HRnum) Then Me.HRnum.Undo Me.HRnum.SetFocus Cancel = MsgBox("You must enter an HR number.", vbCritical, "Data Validation Failure") End If Guest, Sep 2, 2006 #1 Advertisements J. Goddard Guest access 2003 Try taking the SetFocus method out - you are already on the HRNum control, and setting Cancel to non-zero prevents you from leaving the control. Hope this helps. John rmcompute wrote: > I received the following message: > > Error number: 2108 You must save the field before you execute the > GotoControl action, the GoToConrol method or the SetFocus method. > > The form contains a combo box, HRNum, with the Limit to list property set to > No. > There is a sub HRNum_BeforeUpdate which access 2003 error contains the following code to test > for a missing HR Number. I know that the Set Focus is causing the error, > however, when I used a text field instead of a combo box there was no error > and how could I "save the field" as it states in the error. > > Private Sub HRNum_BeforeUpdate(Cancel As Integer) > > If IsNull(Me.HRnum) Then > Me.HRnum.Undo > Me.HRnum.SetFocus > Cancel = MsgBox("You must enter an HR number.", vbCritical, "Data > Validation Failure") > End If > > J. Goddard, Sep 2, 2006 #2 Advertisements Guest Guest It worked. Thank you. "J. Goddard" wrote: > Try taking the SetFocus method out - you are already on the HRNum > control, and setting Cancel to non-zero prevents you from leaving the > control. > > Hope this helps. > > John > > > rmcompute wrote: > > I received the following message: > > > > Error number: 2108 You must save the field before you execute the > > GotoControl action, the GoToConrol method or the SetFocus method. > > > > The form contains a combo box, HRNum, with the Limit to list property set to > > No. > > There is a sub HRNum_BeforeUpdate which contains the following code to test > > for a missing HR Number. I know that the Set Focus is causing the error, > > however, when I used a text field instead of a combo box there was no error > > and how could I "save t