Results 1 to 8 of 8
  1. #1
    N3w2access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    17

    Access VBA in a From (when checkbox is ticked then put "text" in field in table)

    I have 2 tables both linked to SQL Server 1 has policy information and the other has error information both tables are linked with the relationship policy Ref. The error table(table2) has fields Pol ref, Error_Type,error, Comments, response_comments and response_Date. There are 25 types of error so what I have done is copy all fields from table 2 25 times exlcusing the policy ref and Error_Type but to make them relate to the relevent error I need to setup some VBA code that does an if Error1_checkbox is ticked then make Error_Type ="error1" and Error=1 else if error1_checkbox is unticked then make error_type null(blank).

    I hope this is clear but any help on this would really really grateful as I have been trying to do this for a long time and cant figure it out. im sure its a quick if statement but I dont know how to write it as I dont know access VBA.
    If you need any screenshots or more info please let me know. im using ACCESS 2010

    Many thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    What do you mean by 'copy all fields from table2 25 times'? Copied them where?

    If you want to provide db 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
    N3w2access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    17
    Sorry for not being more specific. On the form it will have a label called: Error_Type and fields: Comments, Response_comments and Response_Date from Table2 with a checkbox to state whether it is an error or not. These fields will need code so they only relate to the Error_Type Error1 and they will only record into the table2 when the checkbox is ticked and removed it unticked. As there are 25 types of error the Error_Type can be anything from Error1 - Error25 so I need to copy all the fields for Error_type1 25 times and rename and relate them to the relevant Error_Type. I will attached a screenshot to show what I mean as an example. The main thing is when the checkbox1 is ticked then make Error_Type Error1 if the next checkbox is ticked then make Error_Type Error2 and so on. I will also have to make the fields relate to the correct error_type. If this does not work I will send a copy of the DB but missing the confidential data. Thanks

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    No image attached to post.

    Sounds like you need a single combobox that presents the error types as a list of choices instead of a bunch of checkboxes.
    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.

  5. #5
    N3w2access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    17
    The reason for the checkboxes so that the analyst can make sure each error has been checked also the analyst needs to leave a comment for every error found so that the comments relates to the error Ive tried attaching a picture but I dont think it has attached. Many thanks

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    Attach image or db file. Follow instructions at bottom of my post.

    Sounds like db structure is not normalized. Really need to see something.
    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.

  7. #7
    N3w2access is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    17
    I believe the screenshot has now attached.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,634
    Still not seeing any image.
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  2. Replies: 6
    Last Post: 12-28-2012, 02:54 PM
  3. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  5. Replies: 1
    Last Post: 04-25-2011, 12:36 PM

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