Results 1 to 10 of 10
  1. #1
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185

    Calculated Text box

    Ok, so I have a sum of weight text box that adds up all the weights of the PO's. That works fine. The name of the text box is SumOfWT. Then next to that text box in the footer, I created another text box to calculate a range of if statements. It will not compile for me, I am looking for help? Thanks



    calc: IIf ([Manifest] Like "TRI*", IIf([SumOfWT]<1000,[SumOfWT]*0.42,IIf([SumOfWT]<5000,[SumOfWT]*0.39,IIf([SumOfWT]>=5000,[SumOfWT]*0.37,IIF([SumOfWT]>14000,[SumOfWT]=5180))))), IIf([SumOfWT]<1000,[SumOfWT]*0.28,IIf([SumOfWT]<5000,[SumOfWT]*0.22,IIf([SumOfWT]>=5000,[SumOfWT]=1100,))))

    Also when I try to make changes it seems to not save any changes, how do I get around this?

    Thanks Nick

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    "Compile" intimates that this is done in VBA, although you are mentioning a text box?? If this is in the footer of a continuous form then it needs to refer to fields on the form's record source.

  3. #3
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    Yes, this is not done in VBA. It is done in the text box. When I run the code from the form button it will not open the form so it gives me compile error but the real problem is a syntax error in the text box of a report. it is a contenuos form. I will look at the fields on my record source.

    Thanks,
    Nick

  4. #4
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    I changed the text box to this

    IIf ([Sheet1]![Manifest] Like "TRI*", IIf([SumOfWT]<1000,[SumOfWT]*0.42,IIf([SumOfWT]<5000,[SumOfWT]*0.39,IIf([SumOfWT]>=5000,[SumOfWT]*0.37,IIF([SumOfWT]>14000,[SumOfWT]=5180))))), IIf([SumOfWT]<1000,[SumOfWT]*0.28,IIf([SumOfWT]<5000,[SumOfWT]*0.22,IIf([SumOfWT]>=5000,[SumOfWT]=1100,)))

    It still has a syntax error

    Thanks,
    Nick

  5. #5
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185

    syntax error

    Click image for larger version. 

Name:	syntax.jpg 
Views:	7 
Size:	21.7 KB 
ID:	28719

    This is the syntax error I am getting

  6. #6
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    This is my Report and field list
    Click image for larger version. 

Name:	ReportandFieldlist.png 
Views:	7 
Size:	63.3 KB 
ID:	28721

    Thanks,
    Nick

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    This should be in the control source and should have an = in front.

    You are referring to something called Sheet1 but Access will not know what it is.

    In the error it shows "First" but not in your post.

    Do these one at a time:
    - make a text box with =SumOfWT and see if it displays correctly
    - add the first If statement and see if it displays correctly
    - etc

  8. #8
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    I have no idea why it is adding first to the syntax. The control source does not include the word first.

  9. #9
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    It looks like there is a bracket missing at the end. Like I say, add these one at a time and get them working.

  10. #10
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    Ok I am doing them one at a time and it is working. Thank you for the ideas. I just need to go one at a time.

    Thanks,
    Nick

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

Similar Threads

  1. Calculated Text Field
    By accessmatt in forum Queries
    Replies: 3
    Last Post: 04-14-2015, 11:43 AM
  2. Replies: 1
    Last Post: 03-27-2014, 06:42 AM
  3. Can Calculated Field (Text) Be Edited?
    By melhzy in forum Access
    Replies: 1
    Last Post: 11-26-2012, 12:12 PM
  4. problems with calculated text box
    By mesersmith in forum Reports
    Replies: 0
    Last Post: 01-23-2011, 11:34 AM
  5. Calculated Text Box Populating in Table
    By Debbie in forum Access
    Replies: 2
    Last Post: 11-13-2006, 08:02 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