Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with reports Detail_format

Posted on 2013-11-12
2
Medium Priority
?
473 Views
Last Modified: 2013-11-12
Hello, I'm trying to use the following to conditionally populate a txt box on a report.

I'm getting the error: you can't assign a value to this object

What is the method and syntax to do this sort of thing in Access VBA?


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If CCur(Me.txt_ExtCostSubTotal) > CCur(50) Then
    Me.txt_Administration = 500
    Else
    Me.txt_ExtCostSubTotal = 0
    End If
     
   
End Sub
0
Comment
Question by:gogetsome
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39643200
Those textboxes might be non updateable for a variety of reasons (can't tell from what you have posted).

Try creating two new textboxes, txt_AdministrationNew and txt_ExtCostSubTotalNew (make sure they appear in the same report section as the originals) and set their controlsource properties as follows, using the = signs:


For txt_AdministrationNew:

  =  IIf (CCur(Me.txt_ExtCostSubTotal) > CCur(50), 500, txt_Administration)
   

And for txt_ExtCostSubTotalNew:

   =  IIf (CCur(txt_ExtCostSubTotal) > CCur(50), txt_ExtCostSubTotal, 0)


And see whether those boxes show what you are looking for.
0
 

Author Closing Comment

by:gogetsome
ID: 39643292
So many differences between .Net and Access. Thank you once again for you help.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question