Results 1 to 5 of 5
  1. #1
    dcavaiani is offline Novice
    Windows 10 Access 2002
    Join Date
    Jul 2016
    Posts
    10

    Am I overthinking this ?

    I have a report, from a table, open in report view (no related form). I want a unbound field where I can enter in a variable (specifically a possible shipping charge).



    I have found some VBA code which populates the unbound field, and shows up and calculates into the totals in the Report View, but DOES NOT show up in Print Preview.

    The other thing I tried is w/o vba code, and just tried entering date right into the unbound field on the Report view but that entry disappears quickly and does not calculate into the totals.

    ?

  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,816
    Enter this value in textbox on form. Textbox on report references textbox on form.

    If you don't want a form then must have a popup input prompt in report RecordSource to create a field that textbox can be bound to. Example:

    SELECT *, [enter shipping charge] AS ShippingCharge FROM tablename.

    But shouldn't this data actually be in a record so the report can be accurately recreated at any time?
    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
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Don't know if I'd say you're overthinking it or just going down the wrong path. Reports are not for entering data into and AFAIK, don't have a Recalc method. As for not seeing this control, make sure Always is the Display When property.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    No vba code needed.
    you do this in a form, say txtState.

    the query will look lilke:
    select * from table where [state] = forms!fMyForm!txtState

    if the text box COULD be empty , then you need some code.
    the query will show all recs:
    select * from table
    but the Open Report button will do the filter:

    Code:
    if isNull(txtState) then
      docmd.OpenReport rpt,acViewPreview
    else
    
    docmd.OpenReport rpt,acViewPreview ,,"[state]='" & me.txtState & "'"
    endif

  5. #5
    dcavaiani is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2016
    Posts
    10
    OK - some options I can try. Thank you!

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

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