Hiding fields with data

jake7363

Registered User.
Local time
Today, 18:31
Joined
Mar 14, 2005
Messages
46
Hi,
I have a report that has three fields that could each have a the same customer name in, based on a query that asks for the customer name.
If, for example, two of the fields show the selected customer, is it possible to hide the third field that has a different customer name in?

If it is possible, how would I go about it?

Thanks in advance,
Jake
 
you need to expand on this

if field 1 and field 2 are equal then field 3 is visible/not visble

if you cna logic this then it can be done

so give us your field names and some bright spark will give you the coding for the report .

g
 
on your report properites

have
if x=y then z.visble =false
else
z.visble= true

now you may have to play with this

the x and the y will be field on your report (and may not be the same as your qry)

and you may have to use !
so if me!reportfieldname =me!reportfieldname then me!reportfieldname3 visble = false
else reportfieldname3= true
end if
 
oops last line out reportfiledname3.visble= true



now this will only work if field 1 and 2 are excaty the same - and i mean excatly the same,
 
To ask a bit further, since there is no predictability as to which field will contain the name based on the Select query, would this logic still apply?

If I am asking to show which records contain "John Doe" in any one of the three fields, or all of them, I only want to show the fields that contain John Doe. That might be 1, 2 or 3, or any combo thereof.

Thanks again..
 
hummm.

a real thinker this one- I'll have athink and come back onthis ...
 
You can expand Gary's intial IF to cover all possbilities. I'm assuming that the name isn't known before hand, otherwise simply include it, as a parameter if necessary in your select statement and be done with it.

in psuedo code you're looking at doing something along the lines of

Code:
If (field1 = Field2) and (field1 <> Field3) then
  Field3.visible = false
elseif (field1 <> Field2) and (field1 = field3) Then
  field2.visible = false
elseif (field2 <> field1) and (Field2 = field3) then
 Field1.visible = false
endif
If all three fields are different, or the same, then all fields will be visible.
 
well done

after 2 if's i lose the will to live and my train of thought....
still not too sure this will work - but damn sight better than I could of done .

g
 
I'd be a liar if I said I'd tested it exhaustively and I'm sure I've probably missed something, but a little "widget" that I used to test it seems to come up with the right results:

Code:
  Dim Field1 As String, field2 As String, field3 As String
  
  Field1 = InputBox("enter a value for field1")
  field2 = InputBox("enter a value for field2")
  field3 = InputBox("enter a value for field3")

  If (Field1 = field2) And (Field1 <> field3) Then
    MsgBox ("field3.Visible = False")
  ElseIf (Field1 <> field2) And (Field1 = field3) Then
    MsgBox ("field2.Visible = False")
  ElseIf (field2 <> Field1) And (field2 = field3) Then
    MsgBox ("Field1.Visible = False")
  Else
    MsgBox ("they're all the same/different")
  End If
 
If I would use a custom dialag box, I could test against the data in the dialog box to match against the fields, then...?
 
Last edited:
Me too, I just got sidetracked on doing the hiding thing.
 
OK, to answer honestly, it was not my idea. The issue is that those instances where a customar makes three purchases at different times, in one P.O. The "person" in charge wants all transactions of all instances under one heading of the PO number.

I inherited this mess, and am trying to avoid rewriting the whole thing with separate tables..but I may have to.
 

Users who are viewing this thread

Back
Top Bottom