Results 1 to 10 of 10
  1. #1
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128

    Question Combobox gives me error for all users but first? Need to change past records.

    The purpose of my combobox is that when a user needs to change information or use the same values and save to a different date, the user can use the combobox and find the date they need.

    At the moment I have two forms: frmUserID & frmGenSum

    frmUserID pops up first and a valid user ID must be inputted. Once it is, they can click a button that opens frmGenSum. frmGenSum then has the combobox. The user can click on its dropdown arrow and see all the previous dates they had used and pick accordingly. The form is then meant to change to show the date selected along with the general information that had been inputted for that date. They could then change the information.

    I have a WHERE clause in SQL for the combobox on frmGenSum to show only dates for the user ID entered on frmUserID. And the combobox has the following code:



    DoCmd.FindRecord Me!ctlSearch, acEntire

    My problem is that I can only seem to allow past dates to be clicked for the first user ("0001"), but any other will always give me the Error 3022 when selecting a previously used date. It points to the combobox code as the problem... On top of that, I can't get user 0001 to save the previous data as a different date without freezing and crashing Access. If I'm lucky and Access doesn't crash, it will manage to save after the error, but merely replaces the date chosen for that record instead of creating a new record with that date. It will allow user 0001 to change and add data to the date chosen however.

    I can live without having the user use the old data for a new date, but I really need to be able to pull up the old data for other users to change if necessary. Any help would be much appreciated, this has been driving me nuts! Thank you.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    3022 usually means you are attempting to save a duplicate record. Your index setting (no duplicates) may be trying to prevent this by giving you the message.
    What makes records unique in that table??

  3. #3
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128
    Hi Orange, records are unique due to User ID. I have UserNum set to no duplicates, and Date and UserID are a compound key both allowing duplicates.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Can you put a breakpoint in your code, and step through to see exactly where the error is originating?
    You can not have duplicates in a primary key.

    How do User ID and UserNum relate?

  5. #5
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128
    The error always comes from the combobox:

    DoCmd.FindRecord Me!ctlSearch, acEntire

    UserNum is in a separate table meant for only storing users. UserID is connected through the other table and shows each record they filled out.

    The error is correct in that I cannot have duplicates in the primary key, and I don't want them either. However, I need to be able to choose the date to see the information and then change it if anything is wrong with it.

    I had found a search example database here, and I got the form to only search for the dates for the specified User ID, however, I could not figure out how to connect it to the form and change when choosing one of the dates.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    The database example is using the ONChange event to redisplay the "available records' based on the characters you type.

    I don't think this statement DoCmd.FindRecord Me!ctlSearch, acEntire
    should result in a 3022 error since you aren't trying to update by using a Find... statement.

    I don't have acc2010, so maybe someone else will offer some advice, or you you could post screen shots of some code or form etc to help us understand your issue better.

  7. #7
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128
    The odd thing is it doesn't give the error for user "0001", but for user "0002" it does.

  8. #8
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128
    I have uploaded a version of the database that can be viewed. You'll notice I was trying a view methods: ListBox, ComboBox, and a list example I was trying from another forum posting.

    I can get all 3 methods to show just the records for the chosen user ID, but I can only get the ListBox and ComboBox to populate the values and past dates of user "0001". The list example does not change anything, just displays past information.

    To use it, open frmUserID and input either "0001" or "0002". This will open frmGenSum. You can then click the ListBox or ComboBox values and see their values for "0001", or get an error for "0002".

    If I do choose "0001" I can't change the date to save as a new date with the same information from a previous date (which would be extremely helpful). The bigger issue is that I need to get all users to show their previous date values, so information can be altered in the record.

    Any help would be much appreciated!
    Attached Files Attached Files

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  10. #10
    Heatshiver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    128
    Unfortunately when I try to save as a MDB, it tells me that there's data that corresponds to only my version. Hopefully someone will come along! Or, I'll try to think of what could be taken out to make it a MDB.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Commiting changes in past records
    By spleewars in forum Programming
    Replies: 3
    Last Post: 04-17-2012, 08:31 AM
  2. Replies: 1
    Last Post: 01-11-2012, 06:41 PM
  3. Replies: 2
    Last Post: 10-08-2011, 06:33 PM
  4. Show past records for same user
    By l3111 in forum Database Design
    Replies: 3
    Last Post: 03-03-2011, 10:57 AM
  5. Replies: 1
    Last Post: 03-18-2009, 12:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums