From: Leo on
I hate to cut and paste anything into a module or procedures without
understanding a little about how it works. I came across the following code
that I could really use.
It makes the label blink and using If/End If statements I could use it to
flash warnings and 'expired' dates.

With Label74
.ForeColor = (IIf(.ForeColor = 0, 255, 0))
End With


But I cannot find any ref in any books and not even in the Access help pages
for what is this WITH AND END WITH FUNCTIONS and what arguments go with it.
Perhaps I don's know where to look for!

Any help will be greatly appreciated.

Thanks
Leo
From: NG on
Hi Leo,

with myObject
....
end with

is not a function, it is a statement, meaning that all instruction after the
with refer to the object stated immediately after "with". The end with
closes the statement.

It's something like the if statement:

If ... then
....
end if


--
Kind regards
Noƫlla


"Leo" wrote:

> I hate to cut and paste anything into a module or procedures without
> understanding a little about how it works. I came across the following code
> that I could really use.
> It makes the label blink and using If/End If statements I could use it to
> flash warnings and 'expired' dates.
>
> With Label74
> .ForeColor = (IIf(.ForeColor = 0, 255, 0))
> End With
>
>
> But I cannot find any ref in any books and not even in the Access help pages
> for what is this WITH AND END WITH FUNCTIONS and what arguments go with it.
> Perhaps I don's know where to look for!
>
> Any help will be greatly appreciated.
>
> Thanks
> Leo
From: Krzysztof Naworyta on
Leo wrote:
| I hate to cut and paste anything into a module or procedures without
| understanding a little about how it works. I came across the
| following code that I could really use.
| It makes the label blink and using If/End If statements I could use
| it to flash warnings and 'expired' dates.
|
| With Label74
| .ForeColor = (IIf(.ForeColor = 0, 255, 0))
| End With
|
|
| But I cannot find any ref in any books and not even in the Access
| help pages for what is this WITH AND END WITH FUNCTIONS and what
| arguments go with it. Perhaps I don's know where to look for!


With Label74
.ForeColor = (IIf(.ForeColor = 0, 255, 0))
End With


is equal to:

Label74.ForeColor = (IIf(Label74.ForeColor = 0, 255, 0))

--
KN
From: John Spencer on
Switch to VBA
Select Help from the menu
Enter "With Statement" in the search box
That should give you a hit for the With Statement and MS help on it.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Leo wrote:
> I hate to cut and paste anything into a module or procedures without
> understanding a little about how it works. I came across the following code
> that I could really use.
> It makes the label blink and using If/End If statements I could use it to
> flash warnings and 'expired' dates.
>
> With Label74
> .ForeColor = (IIf(.ForeColor = 0, 255, 0))
> End With
>
>
> But I cannot find any ref in any books and not even in the Access help pages
> for what is this WITH AND END WITH FUNCTIONS and what arguments go with it.
> Perhaps I don's know where to look for!
>
> Any help will be greatly appreciated.
>
> Thanks
> Leo