Results 1 to 7 of 7
  1. #1
    TINMAN is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    64

    Two Simple Questions

    1. Can Visual Basic for Access be used to take a text box calculated integer field from a REPORT to create another text box with a String Field based on Visual Basic calculations on the original text field in the report?

    2. Also I tried using the MOD function for a calculated field in the Expression Builder for the field but I couldn't find it. From what I have read it is available in Visual Basic, can it be used in Access?



    Any recommendations for a first time Visual Basic user for training, I am looking for something very basic.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Your question is somewhat open to interpretation so I'll put it this way:
    you cannot alter report design in any view other than design view, but in design view, no values are available.
    If you can clarify where the calculation is - query or table that the report is based on or in the report textbox itself? Maybe some examples of results and the expression that creates those results would help.

    Yes, Mod function is available in vba. Pretty sure you can use it in a calculated control; just enter it directly and forget about the expression builder perhaps.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    yes. no VB needed, use the query to do the calc, [fld1]+[fld2]
    the report will show it.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    tried using the MOD function
    it is more an operator than a function i.e.

    20 mod 3

    returns 2

    the opposite would be the \

    20\3

    returns 6

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    it is more an operator than a function i.e.
    it seems to matter where you look. M$ calls it an Excel function and a visual basic operator. W3schools call it a SQL function. When you consider how it is written it does resemble an operator moreso I'd say

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    in excel there is a function

    =mod(20,3)

  7. #7
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    1. Can Visual Basic for Access be used to take a text box calculated integer field from a REPORT to create another text box with a String Field based on Visual Basic calculations on the original text field in the report?
    Just tested a sample and was able to use code in the Expression Builder to do something like that:
    =IIf([txtInvSalesTaxCalc]=1574.97,"hi","hello")

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

Similar Threads

  1. Replies: 2
    Last Post: 11-10-2017, 07:52 PM
  2. Replies: 4
    Last Post: 10-16-2016, 06:22 PM
  3. Simple Database Relationship Questions
    By dbmiller5 in forum Database Design
    Replies: 4
    Last Post: 07-18-2016, 12:20 PM
  4. Replies: 21
    Last Post: 04-14-2014, 09:33 AM
  5. Simple questions
    By canfish in forum Database Design
    Replies: 9
    Last Post: 07-23-2010, 02:57 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