Results 1 to 7 of 7
  1. #1
    Ranger351w is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Apr 2014
    Location
    Central Valley of California
    Posts
    5

    Extract the values from the fields in one form to insert them into the next form

    Hi guys,
    I have a db where the main table/form is OperatorReports. I have sub-forms that allow users to review the reports by WorkOrderNumber/Date. The challenge I now face is allowing the user to open a new Operator Report that has the header fields autopopulated by the information on the report they were looking at so that they can continue the project but add their own information. I tried to run with an unbound form that reproduces the original OpReport form but uses expressions to fill the fields and an append query to add the data to the table. However, I get validation errors running the apQuery.
    My goal is to come up with some code to create a dataset of the header info to put into the original OpReport form.
    Not sure of the best way to accomplish this task and am open to any suggestions.
    Respects and regards,
    Chris

  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
    52,944
    So you are moving to a new record on the main form? One method is to set the DefaultValue property of each of the controls you want to carry value forward. Review http://allenbrowne.com/ser-24.html
    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
    Ranger351w is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Apr 2014
    Location
    Central Valley of California
    Posts
    5
    I don't want the values to be default... Just a one time transfer to a new record because the worker is, in this instance, continuing a project but needs his own Op Report, though the header information is the same. I'm not saying this is a one time event. But that on occasion, the worker will be continuing a project and the header data will be the same. The goal is to allow operators to review the previous op report and then click a button to open a new op report that has the header data from the previous worker's report, because he is continuing that persons project.
    The procedure is to open the "Sub Form Reports" from the switchboard, and select a work order number, then open the "By Work Order" read-only form. From there select "Continuing Work Order" to open a new record with header info already populated except "Date", "Shift" and "Operator".
    Respects,
    Chris

  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
    52,944
    Programatically setting the DefaultValue property will be in effect only until the form is closed. User can still type other values in the new record.

    An alternative is to set public/globally declared variables (variables declared in the form or general module header). This allows the variables to be referenced by any procedure in that module or in the case of variables declared in general module, anywhere in the db.
    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
    Ranger351w is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Apr 2014
    Location
    Central Valley of California
    Posts
    5
    I checked the link and from the description Mr. Browne gives it looks like it might be just the thing. It may take some additional work to have the Op Report review be in the actual Op Report form in a read only mode and then have that come off as the new record is brought up...

  6. #6
    Ranger351w is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Apr 2014
    Location
    Central Valley of California
    Posts
    5
    Whew! I was able to correct the issue by building my original ApQuery from scratch... Not sure what the difference was, but it works now... The only issue I have remaining is some calculations... Is there an expression or operator that will prevent the calculation from executing if the field value is zero?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Maybe use IIf

    IIf([field]=0, Null, do calc)
    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: 8
    Last Post: 08-02-2012, 08:48 AM
  2. Replies: 1
    Last Post: 05-25-2012, 02:29 AM
  3. Replies: 1
    Last Post: 03-27-2012, 05:25 PM
  4. Replies: 1
    Last Post: 11-01-2011, 05:55 PM
  5. Replies: 0
    Last Post: 03-08-2011, 05:56 PM

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