Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Checking Two Conditions in a Macro

Geek News

Checking Two Conditions in a Macro
Jani 11/24/2008 2:25:01 PM
Is there a way to check two conditions in a macro at the same time? I want to
check to see if both a date and name are in a table before appending the
data. These need to be checked at the same time as in the dbo table there
could be the same date from another 'name' or the 'name' could be for a
different date. My current code is shown below and the error message states
that the tblDots can't be found but I know it is in the database. Any help
would be appreciated. Thanks! Jani

[tblDots]![Name]=[dbo_uDotsAll]![Name] &
[tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]


Re: Checking Two Conditions in a Macro
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 11/24/2008 2:31:20 PM
They're boolean expressions. Use the And operator:

[tblDots]![Name]=[dbo_uDotsAll]![Name] And
[tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jani" <Jani[ at ]discussions.microsoft.com> wrote in message
news:10E2C1AC-3ECC-4657-BC97-7E5EB2B54ADB[ at ]microsoft.com...
[Quoted Text]
> Is there a way to check two conditions in a macro at the same time? I want
> to
> check to see if both a date and name are in a table before appending the
> data. These need to be checked at the same time as in the dbo table there
> could be the same date from another 'name' or the 'name' could be for a
> different date. My current code is shown below and the error message
> states
> that the tblDots can't be found but I know it is in the database. Any help
> would be appreciated. Thanks! Jani
>
> [tblDots]![Name]=[dbo_uDotsAll]![Name] &
> [tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]
>
>


Re: Checking Two Conditions in a Macro
Jani 11/24/2008 2:44:09 PM
Geez - you're quick! I changed to AND and am still getting a message that the
tblDots can't be found. The message is 'you may have specified a control that
wasn't on the current object without specifying the correct form or report
context. I tried entering [table]! and then table! preceding the code but
those didn't work. Any ideas on what I'm doing incorrectly?

"Douglas J. Steele" wrote:

[Quoted Text]
> They're boolean expressions. Use the And operator:
>
> [tblDots]![Name]=[dbo_uDotsAll]![Name] And
> [tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Jani" <Jani[ at ]discussions.microsoft.com> wrote in message
> news:10E2C1AC-3ECC-4657-BC97-7E5EB2B54ADB[ at ]microsoft.com...
> > Is there a way to check two conditions in a macro at the same time? I want
> > to
> > check to see if both a date and name are in a table before appending the
> > data. These need to be checked at the same time as in the dbo table there
> > could be the same date from another 'name' or the 'name' could be for a
> > different date. My current code is shown below and the error message
> > states
> > that the tblDots can't be found but I know it is in the database. Any help
> > would be appreciated. Thanks! Jani
> >
> > [tblDots]![Name]=[dbo_uDotsAll]![Name] &
> > [tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]
> >
> >
>
>
>
Re: Checking Two Conditions in a Macro
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 11/24/2008 6:09:28 PM
Sorry, I didn't notice that you were referring to a table. You can't refer
to fields in tables like that. You need to use DLookup to get a specific
value.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jani" <Jani[ at ]discussions.microsoft.com> wrote in message
news:725795C8-8007-4585-8191-7CC30BEF4A6F[ at ]microsoft.com...
[Quoted Text]
> Geez - you're quick! I changed to AND and am still getting a message that
> the
> tblDots can't be found. The message is 'you may have specified a control
> that
> wasn't on the current object without specifying the correct form or report
> context. I tried entering [table]! and then table! preceding the code but
> those didn't work. Any ideas on what I'm doing incorrectly?
>
> "Douglas J. Steele" wrote:
>
>> They're boolean expressions. Use the And operator:
>>
>> [tblDots]![Name]=[dbo_uDotsAll]![Name] And
>> [tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Jani" <Jani[ at ]discussions.microsoft.com> wrote in message
>> news:10E2C1AC-3ECC-4657-BC97-7E5EB2B54ADB[ at ]microsoft.com...
>> > Is there a way to check two conditions in a macro at the same time? I
>> > want
>> > to
>> > check to see if both a date and name are in a table before appending
>> > the
>> > data. These need to be checked at the same time as in the dbo table
>> > there
>> > could be the same date from another 'name' or the 'name' could be for a
>> > different date. My current code is shown below and the error message
>> > states
>> > that the tblDots can't be found but I know it is in the database. Any
>> > help
>> > would be appreciated. Thanks! Jani
>> >
>> > [tblDots]![Name]=[dbo_uDotsAll]![Name] &
>> > [tblDots]![DistDate]=[dbo_uDotsAll]![DistDate]
>> >
>> >
>>
>>
>>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net