Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to check a box on report baed on data from other field 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I have a report I'm making to look like a original 2 part hand written form. There are two check boxes a user could check depending on which our Offices they are at.
My form has a combo box that they choose the Office A or B.
I want to check Box A on the report if A is choosen and B if B is choosen.

NO luck with this code
Code:
Private Sub Report_Open(Cancel As Integer)

    If Me!Office.ItemData = "A Then
        Me.OfficeAValue = True
    ElseIf Office = "B Then
        Me.OfficeBValue = True
    End If
    
End Sub
If I use Me!Office with nothing after it, I get error "item has no value"
any Ideas

DougP, MCP, A+
[r2d2]
I love this site and all you folks that helped me over the years!
 
How about setting the control source of the checkbox instead?


=IIF(Me!Office.ItemData = "A",True,False)


I often forget where true/false and yes/no are used, so you may have to substitute accordingly.

Additionally the problem with your code is that you have an open double quote for your text or string literal but no closing double quote.
 
yep fantastic
have a star

DougP, MCP, A+
[r2d2]
I love this site and all you folks that helped me over the years!
 
here is the code that works
Code:
=IIf([Office]="B",True,False)
=IIf([Office]="A",True,False)

.itemdata pops up a prompt box

DougP, MCP, A+
[r2d2]
I love this site and all you folks that helped me over the years!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top