Access form error

Posted on 2011-10-25
Last Modified: 2012-08-13
I have a form that uses a query on a single table as a record source, I want to change one record on click of a combo so I added this to the click event: -
    sql = "SELECT tbl_Complaints.IdNumber, tbl_Complaints.TxtCategory "
    sql = sql & "From tbl_Complaints "
    sql = sql & "WHERE tbl_Complaints.IdNumber=" & Me!IdNumber
    Set Rst = Dbs.OpenRecordset(sql, dbOpenDynaset, dbSeeChanges)
    If Rst.RecordCount > 0 Then
            If Me!CboCompCat = "None" Then
            Rst!TxtCategory = ""
            Rst!TxtCategory = Me!CboCompCat
            End If
    End If

If the user changes a record on the form and then clicks the combo they get an error. I can't seem to replicate this and they are using Access runtime so I can't identify the error.

Can anyone help?
Question by:HKFuey
    LVL 19

    Expert Comment

    You might try the After Update Event of the combo box.

    If you can post a sample DB, with only the form and a table/s in question we can see clearly the issue.



    Accepted Solution

    Found this on Google going to try: -
    If Me.dirty then Me.dirty = False

    Also added an error trap, should help as well.
    LVL 47

    Assisted Solution

    by:Dale Fye (Access MVP)
    Can you get your runtime user to do a printscreen so we can see the error they are getting?  Without knowing what the error is, it's like looking for a needle in a haystack.

    Is the form you are working on bound to the "tbl_Complaints" table?

    If so, then why don't you just make the [TxtCategory] a bound control on the form.  Then you don't need this additional code.

    If the form is not bound to "tbl_Complaints", they where are you getting the ComplaintID from that you are using in your recordsource?


    Author Comment

    The form is bound to the table, yes.
    The error they got was "Runtime Error", not very helpful. They have been working on it since I did the changes without problem, so I'll just have to wait...

    Re: "If so, then why don't you just make the [TxtCategory] a bound control on the form.  Then you don't need this additional code."
    I'm using a combo box to assign category then refresh the form behind, will this method work?
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    How is the table bound to the form?  Is the RecordSource of the form the table, or is it a query (this really doesn't matter as long as the query can be updated)?

    Can you take a screen shot of your form and post it here?

    Author Closing Comment

    Thanks for the help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    Familiarize people with the process of utilizing SQL Server functions 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 Ac…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    737 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

    18 Experts available now in Live!

    Get 1:1 Help Now