Results 1 to 5 of 5
  1. #1
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194

    Lightbulb Autofill data on another form

    I'd like to know if it's possible to write VBA that will (from form 2):


    1. open form 1
    2. write information from two fields on form 2 to form 1 [field1] and [field2]
    3. close form 2
    4. display a message.

    I have form 1 that is a precursor to everything in form 2. Form 2 has subforms and calculated fields that point to information from form 1 [field1] and [field2].

    Problem is, when there is no data written the user has to open form 2 to enter in information on [field1] and [field2] only to close the form themselves and retype the information in form 1.

    I'd like to automate this process. Can this be done?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Almost anything is possible with enough code.

    Don't understand data structure nor the process you want to implement. Why is data duplicated?
    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
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    June! Maybe you can help me with this. I thought of another way to attack this problem. Instead of having redundant information on two forms, I could try a 'not in list' event that would add the information I need to the table before opening form 2. The problem is. I cannot get this code to work. Nothing happens.
    StrSql = "INSERT INTO tbl_RawMaterial([Raw Material]) " & _ "VALUES ('" & NewData & "');"
    DoCmd.SetWarnings False
    DoCmd.RunSQL StrSql
    DoCmd.SetWarnings True
    Response = acDataErrAdded

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Is LimitToList property set to Yes?

    http://www.fontstuff.com/access/acctut20.htm
    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
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    You're a champ. That was a simple fix. Thanks June.

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

Similar Threads

  1. autofill form not saving data in table
    By lmahere in forum Programming
    Replies: 9
    Last Post: 05-20-2016, 01:05 PM
  2. Autofill Form Data
    By Notters in forum Forms
    Replies: 6
    Last Post: 05-02-2012, 11:30 AM
  3. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  4. Replies: 4
    Last Post: 01-05-2011, 07:56 AM
  5. Autofill with data from another form
    By jacrum in forum Forms
    Replies: 2
    Last Post: 08-11-2009, 11:17 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