Results 1 to 5 of 5
  1. #1
    JJAMII is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    11

    Filling a textbox with the answer to an operation involving values from other text boxes

    Hey



    I'm currently in the process of building a rental database. I have a form with the purpose of checking in a returned rental. On this form is a Textbox which stores the issue date, and another which the user enters the return date. I want to have a textbox which from a button press, will display the cost of the rental, by determining the amount of days between the two dates stored in those text boxes, and multiplying that number of days by a daily rental charge.

    I have experimented with methods including dateDiff in VBA on the click event for the Calculate button, but am having trouble getting the values from the text boxes to operate on. Any help would much appreciated.

    Thanks, James.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Have you tried

    Me.TextboxName

    presuming the code is on the same form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JJAMII is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    11
    With a little bit of playing around i've managed to solve it, thanks though!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Posting your solution could help later forum users.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    JJAMII is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    11
    Ah yeah good shout. Well haven't got a complete solution but it's easy from here on out.

    Dim firstDate As Date, secondDate As Date, difference As Integer


    firstDate = DateValue(Me.FirstdateTextBox)
    secondDate = DateValue(Me.SecondDateTextBox)


    difference = dateDiff("d", firstDate, secondDate)


    Me.DifferenceTextbox = difference


    That displays the difference between the two dates in a text box for me. All i need to do now is add a sum for difference x 'dailycharge' and i'm sorted.

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

Similar Threads

  1. Preventing Duplicate Data Involving 2 Values
    By EdaxFlamma in forum Forms
    Replies: 3
    Last Post: 05-06-2015, 12:13 PM
  2. Adding the values from 3 Text Boxes
    By crimedog in forum Reports
    Replies: 7
    Last Post: 02-26-2015, 11:24 AM
  3. Replies: 2
    Last Post: 08-23-2013, 02:36 AM
  4. Replies: 5
    Last Post: 04-01-2013, 11:49 AM
  5. Replies: 1
    Last Post: 12-15-2011, 04:44 AM

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