Results 1 to 3 of 3
  1. #1
    topp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    12

    Autofill field based on combo box

    Hello All,



    I have created a combo box that represents the status of a form (OPEN or CLOSED). What I am trying to make happen is that when the combo box gets updated to "closed" I would like the current date to automatically be filled into another form. I have created some basic code in VBA but having no experience with it doesnt help. Here is the code I have so far:
    Private Sub Combo104_AfterUpdate()
    If (Forms![RMA].Combo104.Value = "Closed") Then
    Forms![RMA Log]![ClosedDate] = Date
    DoCmd.RunCommand acCmdSaveRecord
    End If
    End Sub
    When I try and save the record I get a run-time error of 7878: The data has been changed. Any suggestions would be greatly appreciated!!
    Thanks in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Is this combobox an unbound control? The save record is acting on the form the code is behind, not the other form.

    This seems like an odd arrangement. Why is the combobox not on the same form with the date field?

    Want to provide the file for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    topp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    12
    Lol, Thank you for pointing out the obvious to me. I for some reason was trying to set the field on another form for absolutely no reason and once I switched it to the form it was on it worked perfectly. Thank you for you help!!

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

Similar Threads

  1. Replies: 5
    Last Post: 10-14-2011, 09:56 AM
  2. PLEASE help: Autofill based on one field
    By Suzanne in forum Forms
    Replies: 5
    Last Post: 07-07-2011, 11:09 AM
  3. Autofill of a field based on another
    By MyWebdots in forum Forms
    Replies: 7
    Last Post: 07-12-2010, 05:00 AM
  4. Autofill form fields based on another field
    By ljs1277 in forum Access
    Replies: 3
    Last Post: 02-16-2010, 02:51 PM
  5. Autofill field based on autonumber field
    By frevilla in forum Forms
    Replies: 1
    Last Post: 09-11-2009, 02:50 AM

Tags for this Thread

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