Hiding fields with data (1 Viewer)

jake7363

Registered User.
Local time
Today, 08:30
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
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:30
Joined
Nov 8, 2005
Messages
3,294
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
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:30
Joined
Nov 8, 2005
Messages
3,294
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
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:30
Joined
Nov 8, 2005
Messages
3,294
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,
 

jake7363

Registered User.
Local time
Today, 08:30
Joined
Mar 14, 2005
Messages
46
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..
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:30
Joined
Nov 8, 2005
Messages
3,294
hummm.

a real thinker this one- I'll have athink and come back onthis ...
 

tehNellie

Registered User.
Local time
Today, 13:30
Joined
Apr 3, 2007
Messages
751
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.
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 05:30
Joined
Nov 8, 2005
Messages
3,294
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
 

tehNellie

Registered User.
Local time
Today, 13:30
Joined
Apr 3, 2007
Messages
751
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
 

jake7363

Registered User.
Local time
Today, 08:30
Joined
Mar 14, 2005
Messages
46
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:

tehNellie

Registered User.
Local time
Today, 13:30
Joined
Apr 3, 2007
Messages
751
Me too, I just got sidetracked on doing the hiding thing.
 

jake7363

Registered User.
Local time
Today, 08:30
Joined
Mar 14, 2005
Messages
46
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

Top Bottom