?
Solved

Access form error

Posted on 2011-10-25
6
Medium Priority
?
294 Views
Last Modified: 2012-08-13
Hi,
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
    Rst.Edit
            If Me!CboCompCat = "None" Then
            Rst!TxtCategory = ""
            Else
            Rst!TxtCategory = Me!CboCompCat
            End If
            Rst.Update
    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?
0
Comment
Question by:HKFuey
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 37023209
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.

Sincerely,

Ed
0
 

Accepted Solution

by:
HKFuey earned 0 total points
ID: 37023252
Found this on Google going to try: -
If Me.dirty then Me.dirty = False

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

Assisted Solution

by:Dale Fye
Dale Fye earned 2000 total points
ID: 37024261
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?

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:HKFuey
ID: 37024308
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?
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 37024357
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?
0
 

Author Closing Comment

by:HKFuey
ID: 37087208
Thanks for the help!
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 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