Controlling Edits

I have a subform in datasheet view. I'd like to lock the text box named 
chrMeasureName for existing records but allow users to enter it in new 
records.
I've tried this code

Private Sub Form_Current()
If Me.NewRecord Then
    Me.chrMeasureName.Enabled = True
    Me.chrMeasureName.Locked = False
    Else: Me.chrMeasureName.Enabled = False
    Me.chrMeasureName.Locked = True
End If
End sub
This works until chrMeasureName (a text box) is selected in the new record 
row and one of the records above is clicked. This generates an error for 
trying to disable a control that has focus.
Is it possible to limit edits the way I want.  I'm wondering if I can solve 
this through error handling or if there's another approach.  I thought one 
solution would be to have two different forms, one to allow new entries and 
another to enter measure descriptions, but I'm hoping there's a more elegant 
solution.
Thanks
EQC
0
Utf
12/18/2009 8:18:01 AM
access 16762 articles. 3 followers. Follow

2 Replies
760 Views

Similar Articles

[PageSpeed] 44

hi,

On 18.12.2009 09:18, E.Q. wrote:
> This works until chrMeasureName (a text box) is selected in the new record
> row and one of the records above is clicked. This generates an error for
> trying to disable a control that has focus.
You can use the ActiveControl property of the form to determine which 
control is focused.

> Is it possible to limit edits the way I want.  I'm wondering if I can solve
> this through error handling or if there's another approach.

If Me.ActiveControl = chrMeasureName Then
   otherControl.SetFocus
End If
chrMeasureName.Enabled = False

And use the error handling method as fallback.


mfG
--> stefan <--
0
Stefan
12/18/2009 9:03:06 AM
Thanks, this was the last piece needed to generating a front end that 
contains the features the users said they wanted.  Your help is greatly 
appreciated.
0
Utf
12/19/2009 5:05:01 AM
Reply:

Similar Artilces:

scalable headings in Microsoft Excel when editing long formulas
I use Excel a lot (2000 and 2003) and frequently create long formulas which have 4 or more rows. When I have the size of my workbook maximized, these formulas hide my column headings (A,B,C,etc.). When formulas become more than 1 row, the size of the maximized window should always modify so that a user can always see the column references while editing. Is there a way to do this without constantly having to re-size my active workbook window (i.e. taking it off maximized)? It is so aggravating ... ---------------- This post is a suggestion for Microsoft, and Microsoft responds to th...

why won't word 2007 release control of a .rtf file after exiting w
I AM HAVING TROUBLE WITH ACCESS TO RICH TEXT FILES BY PROGRAMS OTHER THAN WORD------ AFTER THE FILE OPEN IN WORD IS CLOSED AND EVEN AFTER WORD HAS BEEN SHUT DOWN (EXITED) ---------- I GET THE ERROR MESSAGE THAT THE FILE IS "IN USE" BY WORD WHEN (FOR EXAMPLE) AN ATTEMPT IS MADE TO DELETE IT ---- SOMETIMES WHEN RE-OPENING THE FILE AFTER RE-STARTING WORD THE FILE CANNOT BE SAVED BECAUSE IT IS IN "READ ONLY" MODE ------- AFTER MUCH FIDDLING AROUND I FINALLY MANAGED TO DELETE THE PROBLEM FILE ONLY TO HAVE THE SAME PROBLEM RETURN WITH A DIFFERNT FILE ----- WORD 200...

RE: Control
Can some one point me right direction to achive this following. Need to dispaly a data in a table format. some of the column data may have to display a image/icon based on a value from the table (1 :- Red color icon, 2:-yellow color icon...) Once the data is loaded and displayed on the format , able to search particular row by column index and update the values including the images(change different image). I tried with Listview control, with the report view I am not able to search row and update the columns with the List vew I am not able to show the image/icon. do not want to use ...

bound control or inbound control
Hi Katherine, There are differences between using bound versus unbound controls. Where on the form do you want to use an unbound control? Jeanette Cunningham "Katherine" <Katherine@discussions.microsoft.com> wrote in message news:23BBC192-0A74-4B9F-9513-5E5923A76658@microsoft.com... > ...

How to edit a continuous subform's recordset in batch
Hello: I have a main form with a continuous sub form. Suppose the main form is bound to the Orders table and the sub forms is bound to the Order Details table. In the main form's oncurrent event, I use the following code to make the subform synchronous to the main form Me.subform.form.filter = "OrderDetails.orderID = me.orderID" me.subform.form.filteron = true There are about 10 rows in the subform. I want to allow users to edit values on any row and append rows on the sub form, and then click the save button to save all the changes to the subform's underlying table in b...

MSCRM login and the Users Control Panel
Is anyone aware of any way that the settings stored under Control Panel - Users - Password Management might interfere with the process of Single Sign On into MSCRM? It seemed to have somehow cached someones login and prevented logging in as the logged in user, until cached credentials had been "deleted". However I have never seen this mentioned as being relevant. I am not too sure what the architecture model is there, but it appears to be a single domain. If this area has any relevance, it would be useful to know....thanks ...

Adding a control variable
Hello all, Under VC++ 7.1, I've added a checkbox to a dialog. Using the dialog editor, I am not trying to add a control variable for this check box. However, when I right-click on the check box and select "Add Variable", the resulting wizard dialog does not allow me to select "Control Variable" (it is grayed out). What do I need to do to get a control variable for this check box added to my class? Thanks, Dave I've never seen that before - are you able to duplicate this problem with other projects too? -- Regards, Nish [VC++ MVP] "Dave" <bett...

Releasing memory after creating OCX control
Hi, I try to create an instance of an activex control in my MFC dialog based app. Though my application works with out any error, if i check the memory after calling "delete pMyControl" it keeps on occupying the same memory it occupied when the control was alive. Could anyone help me where I am missing to clear the memory? Thank you. My Code here ---------------m_pxWmp= new CWMPPlayer4();if( m_pxWmp->Create("replay", WS_CHILD | WS_BORDER | WS_VISIBLE , CRect(100, 100,320,240), this, 2)){ m_replay = true; m_pxWmp->SetUrl("C:\\video.avi"); m_pxWmp->Set...

Spam control - MS Outlook
Hi! I am using MS Outlook 2000 and use 2 profiles. I recently installed a firewall package (Fsecure = Telia S�ker Surf), including Spam control. After install, MSO hangs and I cannot change to the other profile (if I not removed MSO by ctrl/alt/del) Somebody want to comment this? /Sven-Erik Intergrated AV/Spam is the cause of frequent issues in Outlook Is the FSecure you installed compatible with this old version of Outlook? "Storfille" <storfille@ebrev.net> wrote in message news:b1Ixm.11987$U5.164765@newsb.telia.net... > Hi! > > I am using MS Outlook 200...

stock control system
trying to see up a 'basic stock control sytem' for a warehouse that contains building materials. -- Thank you. You can use multiple ways of doing, there's 3 ways to come to m head... 1) Use a worksheet as database an save all the information on the cell of that worksheet using some macros to access it and handle. 2) You might want to use Access instead of Excel, I think would b easier to handle the database portion and you still have the Macro available. 3) You can use VB with an Access to create an application -- fanay ------------------------------------------------------...

Creating dialog controls at run-time
I've been researching how to do this, but whenever I try what other people do, I get very bad results. But my challenge doesn't end there. The number of controls I want to create is only known at run-time. The problems I face are manifold: 1. The code most people use fails badly. Not only is the font unconventionally big, but when I click the checkbox I create, the whole dialog disappears. If that's not enough, the pointer to the control is NULL when the dialog's destructor is called, so I can't delete the instance, and get a memory leak message when the program ends: CADi...

what control can display characters from txt files in a dialog?
I want to read lines from txt files and display them on a dialog.I wonder which control can be put into the dialog to hold the characters from txt? Something like :- while(m_file.ReadString(tmpstr)) { str += tmpstr; } m_edit.SetWindowText(str); -- Regards, Nish [VC++ MVP] "liao_xf" <sclxf@sina.com> wrote in message news:001401c3652f$177b9830$a001280a@phx.gbl... > Thanks first! > I know that Edit control can receive and edit input. > and I know the filestdio can read lines from txt. > but can you tell me how to attatch the lines to the edit? > Thanks!...

Office97 home edition Excel
My new Vista operated Dell inspiron does not run the Server add on from my Office 97 disk. It was fine with the previous XP machine. Is there anything I can do to get it working? The Help files don't work with Vista it seems. Thanks Alan C r.combellack@nspmexplorenet.com -- Posted via a free Usenet account from http://www.teranews.com ...

MDI support in ATL composite control
Hi, I have components created in ATL. The components are ATL composite controls. Entire work has been done till now using ATL, however I now need to give MDI type of work area (based o doc-view architecture) within the control. I have class derived from CMDIFrameWnd. However when I try to initialize instance of this class by calling "Create" method of CFrameWnd (base class in CMDIFrameWnd), I get error and creation fails. Tracing the code, I found that base class create method calls "AfxGetInstanceHandle" to get handle to the DLL. Now since this is ATL Composite control, ...

View Filtering and Access Controls for Business Units
I am trying to implement MS-CRM for my company. We have multiple Business Units . I need to give views to each Business Units so that they see only their own Contacts/Accounts/Opp lists. How do I accomplish this ? Also, If I gave inter business unit acesses , how do I make sure that the one business unit users can not modify any fields on other's Business Unit's records ? Thanks in advance for any help, Kishore This is quite easy to do with CRM. Assuming you have already created your Business Units in CRM, you can view a security role within one of the Business Units and a...

formview edit issue
I have a gridview (master) that when a linkbutton is used it opens the formview (detail) for the record. It is all working. The linkbutton opens a showModalDialog rather then the modalpopupextender. function ShowChangeRequestDetail(ChangeRequestID) { window.showModalDialog("ProteusListDetailView.aspx?ChangeRequestID=" + ChangeRequestID, "", "dialogWidth:700px; dialogHeight:500px; resizable:no; scrollbars:no"); } As mentioned, it all works like it should. The issue is when I use the Edit button on the form...

Tab Control Problems
I previously worked in VC++ 6.0, and have several applications that have either custom shadebox controls, or tab controls or group boxes. In all cases, when I moved the applications over to VS.NET 2003, everything was fine, except in the resource editor, I cannot see any of the controls that have been overlayed on a tab control, or a custom shadebox control and in some cases group boxes. I can tab to them and see the outline, but I cannot see the actual controls. If I drag a new control onto the tab control, I can see the control, but once it is saved, I can no longer access the cont...

Panerai Luminor Sealand for Purdey Fourth Edition Mens Watch PAM00832, Best Wristwatch World
Panerai Luminor Sealand for Purdey Fourth Edition Mens Watch PAM00832, Best Wristwatch World Click Here To Website : http://www.watchebay.net/Panerai-Luminor-Sealand-for-Purdey-Fourth-Edition-Mens-Watch-PAM00832.html Wristwatch World: http://www.watchebay.net/ Panerai Luminor Sealand for Purdey Fourth Edition Mens Watch PAM00832 Information : Brand : Panerai Watches ( http://www.watchebay.net/Panerai-Watches.html ) Gender : Mens Code : PAM00832 Also Called : PAM 832 Case Material : Stainless Steel - Brushed Case Thickness : Dial Color : Black...

FindRecord Control Button
i built a find record control button so a user can type in the form number and go there but it only searches the field that the cursor is in and the form # is not on the tab order(purposely). How can i specify where the find record function searches? thanks Ryan, usually people use an unbound combo box or an unbound text box for searching. There is a sample download with code of a search form at http://www.allenbrowne.com/ser-62.html If you need help to get it working, post back. You can also use the wizard to put a combo for searching on your form. On the form in design view, click the...

Controls coordinates
Hi everyone, Could somebody give me a simple example of getting a controls coordinates and then using them to put the control back where it was. So basicaly the control hasn't moved. Here's what I'm doing: m_cQuality.GetWindowRect(&qualityRC); ClientToScreen(&qualityRC); // int temp=qualityRC.Height(); // qualityRC.top=unyteRC.bottom-temp; // qualityRC.right=qualityRC.Width(); // qualityRC.left=0; // qualityRC.bottom=qualityRC.top+temp; // m_cQuality.MoveWindow(&qualityRC); m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top, qualityRC.Width(), qualityRC.He...

User Control to Control Other User Control
Has anyone here created a control that controlled the content of other controls? I have my own custom ad control (for displaying space ads). I may have several on a page. What I'd like it to create another control that could determine how many instances of the first control existed on the current page, build a list of ads, and then set each control to show a particular ad. Is this practical? Suggestions? Thanks. Jonathan "Jonathan Wood" <jwood@softcircuits.com> wrote in message news:uQ5stZRnKHA.1552@TK2MSFTNGP05.phx.gbl... > Has anyone...

Including MDA information in transaction edit reports
GP 8.0 I would like to include MDA entry with the AP transaction edit list so the input can be reviewed before releasing a batch for posting. Same thing applies to our invoicing. What is the best way to accomplish this task? I have coded this once for a customer. The only method that can work seamlessly is a Dexterity customisation which uses a trigger to add extra lines into the temporary table used for the report just prior to printing. David Musgrave [MSFT] Senior Development Consultant Escalation Engineer - Great Plains Microsoft Dynamics Support - Asia Pacific Microsoft Dynamics (f...

Controlling drawing objects in Excel . . .
i m trying to do the following. 1) i draw 10 circles, 10 rectangles and 10 ellipses (all are scattering here & there) in excel. 2) i would like to change all the sizes of circles with minimum steps. [Is it possible to control in such a way that a circle is drawn as a master one, and that circle will be copied and copied until required number. When we want to change something to all circles, we will change the master circle, and all other circles will be automatically changed.] If someone knows, kindly explain to me. Thanks & Have a nice day!!! Thaw Htin Oo. Thaw, (Oo?) One...

Need more than 1208 controls per sheet
Hi, Does anyone know how to go around the limitation of MS Excel, which doesn't let the user, through automation, to create more than 1208 controls (checkboxes, buttons, or combination of two for example) on one sheet?? Thanks much! -- mowali ------------------------------------------------------------------------ mowali's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=20886 View this thread: http://www.excelforum.com/showthread.php?threadid=491476 I don't know whether it is possible to overcome the limit, but I would not use a worksheet where the ...

Outlook 2000 with XP Home Edition
Login window continuosly pops up even after entering proper user name & pw. ...