change a form from edit to read-only after entering data in a combo box

Posted on 2004-10-27
Last Modified: 2006-11-17
I have created a form that is read-only with loaded/opened. I have created a combo box that allows the user to select a record in the master database and then fills in the form.

I have been successful in getting the combo box to allow entry with allowedits=true in KEYPRESS, the form is filled in, but once I hit enter even though I have put allowedits=false in ON CLICK, ON ENTER.

Can this be done ? Have I forgotten something ?

Question by:proffittware
    LVL 39

    Expert Comment

    use the AfterUpdate event of the combobox.
    one way I have done this in the past is to put the "Find" combobox in a seperate subform that is not bound and has AllowEdits= true and leave the main form AllowEdits = False. You only need to adjust your FindFirst code to reference me.Parent...

    If you want to go this way please post your code and we can fix it up :-)



    Author Comment

    Yes, I did the subform initially and it worked they way I wanted.

    I was just trying to do a one screen "Find/Search", then data entry or read-only. I have buttons ADD, EDIT, SAVE that change the read-only/data entry back and forth. But the "FIND" combo box is a problem. Do you think this can be done?


    Author Comment

    I tried adding to my AfterUpdate:


    In my AfterUpdate event I put the above statment - after the Private statement- tested and then before the End Sub- tested and they both did not work.

    I had tried this before asking for help, maybe my AfterUpdate event has a problem?

    Private Sub Text1_AfterUpdate()
    Me.RecordsetClone.FindFirst "[SSN]=" & "'" & Me![Text1] & "'"
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub
    LVL 39

    Accepted Solution

    Private Sub Text1_AfterUpdate()
        Me.Recordset.FindFirst "[SSN]=" & "'" & Me![Text1] & "'"
        Me.AllowEdits = False
    End Sub

    Author Comment

    Sorry I did not get back with you sooner...had Internet issues.

    Thanks for your input !!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now