Selasa, 26 Februari 2013

RE: [MS_AccessPros] Object visibility

 

Paul-

To detect if you're on the "new" record at the end, perhaps do:

If Me.NewRecord Then Exit Sub

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications

SQL Queries for Mere Mortals

http://www.viescas.com/

(Paris, France)

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of paulc8481
Sent: Tuesday, February 26, 2013 9:54 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Object visibility

Bill,
The code works well going from record to record, but when it came to the
last record I was getting an error message saying "wrong use of Null" I seem
to have corrected that problem with the following code. What do you think?
Now that I seem to have gotten the visibility change right going "record to
recort" I want the change to happen WITHIN the record form when the control
is TRUE or it is made Blank. I have read to do this from within, the
Onclick, LostFocus or the Tab events would help but they did not. Im sure I
have the right idea "Well at least in my mind" but again I am missing
something.

thanks

Private Sub Form_Current()

Dim serProTrue As Boolean
Dim serProFalse As Boolean

If IsNull(serProFalse = (cboServiceProvider)) Then
lblChemoWaste.Visible = serProFalse
txtChemoWaste.Visible = serProFalse
Else
serProTrue = (cboServiceProvider = "Advant-Edge Solutions")
lblChemoWaste.Visible = serProTrue
txtChemoWaste.Visible = serProTrue
End If

End Sub

--- In MS_Access_Professionals@yahoogroups.com
, "Bill Mosca" wrote:
>
> My fault, Paul. I accidentally included "If" and a line return. It should
have been:
> Dim bolShowCtrl as Boolean
>
> bolShowCtrl = (cboServiceProvider = "Advant-Edge Solutions")
> lblChemoWaste.Visible = bolShowCtrl
> txtChemoWaste.Visible = bolShowCtrl
>
>
> Bill
>
>
> --- In MS_Access_Professionals@yahoogroups.com
, "paulc8481" wrote:
> >
> > Hi Bill,
> >
> > Thanks for the input but I have tried the code you gave me and I keep
getting either "expression error" or "Syntax error" I modified your code a
couple of ways but still the errors occur. I'm sure I'm doing something not
quite right, so I went back to using my code in the "current event" and it
worked ok except that If the control field is made blank, the other fields
do not disappear. Do I need to place some code in the "after update" event
or in some other event?
> > To be honest I would really like to use your version of the code. It
looks so professional and that is what I really want to learn; different
ways to code well. I like the whole idea of making the If statement an
expression in itself and setting it equal to the boolean variable.
> >
> > Thanks and always learning
> >
> > Paul
> >
> >
> > --- In MS_Access_Professionals@yahoogroups.com
, "Bill Mosca" wrote:
> > >
> > > Paul
> > >
> > >
> > >
> > > You will have to put the code in the form's Current event so it checks
each
> > > record.
> > >
> > >
> > >
> > > And here is a shorter version:
> > >
> > >
> > >
> > > Dim bolShowCtrl as Boolean
> > >
> > >
> > >
> > > bolShowCtrl = (If cboServiceProvider = "Advant-Edge Solutions"_
> > > lblChemoWaste.Visible = bolShowCtrl
> > > txtChemoWaste.Visible = bolShowCtrl
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Regards,
> > > Bill Mosca,
> > > Founder, MS_Access_Professionals
> > > That'll do IT http://thatlldoit.com/> http://thatlldoit.com
> > > MS Access MVP
> > >
> > >
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-6427073088
1E>
> > >
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-6427073088
1E
> > >
> > > My Nothing-to-do-with Access blog
> > >
> > > http://wrmosca.wordpress.com> http://wrmosca.wordpress.com
> > >
> > >
> > >
> > > From: MS_Access_Professionals@yahoogroups.com

> > > [mailto:MS_Access_Professionals@yahoogroups.com
] On Behalf Of paulc8481
> > > Sent: Sunday, February 17, 2013 10:32 AM
> > > To: MS_Access_Professionals@yahoogroups.com

> > > Subject: [MS_AccessPros] Object visibility
> > >
> > >
> > >
> > >
> > >
> > >
> > > I am trying to get a field to appear and disappear when a certain
value is
> > > entered in a textbox. I have been able get the text box to appear when
the
> > > correct value is selected and disappear when the value is changed to
another
> > > value, but if I choose to make the textbox blank the other textbox
does not
> > > disappear. Also when the textbox is visible it remains visible when
scrolling
> > > through all the other records even when the value in the textbox
changes to a
> > > value that should make it go blank. below is the code I am using.
> > >
> > > Any help would be appreciated.
> > >
> > > Thanks Paul
> > >
> > >
> > > Private Sub cboServiceProvider_AfterUpdate()
> > >
> > > If cboServiceProvider = "Advant-Edge Solutions" Then
> > >
> > > lblChemoWaste.Visible = True
> > >
> > > txtChemoWaste.Visible = True
> > >
> > > ElseIf cboServiceProvider <> "Advant-Edge Solutions" Or
cboServiceProvider.Value
> > > = " " Then
> > >
> > > lblChemoWaste.Visible = False
> > >
> > > txtChemoWaste.Visible = False
> > >
> > > End If
> > >
> > > End Sub
> > >
> > >
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
>

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (11)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar