PC Review


Reply
Thread Tools Rate Thread

Code not OK with Set Temp Var or Set Value but is OK with MsgBox

 
 
Andrew P.
Guest
Posts: n/a
 
      4th Sep 2008
Hi All

Im a bit confused as to why Access2007 throws errors back when I use the
following statement with set value or set temp var, but is fine with msgbox:

=DLookUp("[AutoASC]","[RetailerASCList]","ID= [Forms]![ClaimEntry]![Store]")

When it complains, it throws a screen with "Action Failed" and error number
2950.

Any help would be great
Thanks
Andrew
 
Reply With Quote
 
 
 
 
Brent Spaulding \(datAdrenaline\)
Guest
Posts: n/a
 
      4th Sep 2008
I would suggest that you create the literal string in your criteria of the
DLookup() ...

If "ID" is Numeric ...
=DLookUp("[AutoASC]","[RetailerASCList]","ID=" &
Nz([Forms]![ClaimEntry]![Store],0))

If "ID" is Text ...
=DLookUp("[AutoASC]","[RetailerASCList]","ID='" &
Nz([Forms]![ClaimEntry]![Store],"") & "'")

Also, make sure the form is open before you run the macro ..

--
Brent Spaulding | datAdrenaline | Access MVP

"Andrew P." <(E-Mail Removed)> wrote in message
news:87771994-2C4E-46C0-9DAC-(E-Mail Removed)...
> Hi All
>
> Im a bit confused as to why Access2007 throws errors back when I use the
> following statement with set value or set temp var, but is fine with
> msgbox:
>
> =DLookUp("[AutoASC]","[RetailerASCList]","ID=
> [Forms]![ClaimEntry]![Store]")
>
> When it complains, it throws a screen with "Action Failed" and error
> number
> 2950.
>
> Any help would be great
> Thanks
> Andrew



 
Reply With Quote
 
Tom van Stiphout
Guest
Posts: n/a
 
      4th Sep 2008
On Wed, 3 Sep 2008 20:10:04 -0700, Andrew P.
<(E-Mail Removed)> wrote:

Try this:
=DLookUp("[AutoASC]","[RetailerASCList]","ID=" &
[Forms]![ClaimEntry]![Store])

-Tom.
Microsoft Access MVP


>Hi All
>
>Im a bit confused as to why Access2007 throws errors back when I use the
>following statement with set value or set temp var, but is fine with msgbox:
>
>=DLookUp("[AutoASC]","[RetailerASCList]","ID= [Forms]![ClaimEntry]![Store]")
>
>When it complains, it throws a screen with "Action Failed" and error number
>2950.
>
>Any help would be great
>Thanks
>Andrew

 
Reply With Quote
 
Andrew P.
Guest
Posts: n/a
 
      4th Sep 2008
Hi Brent

Different error now:
"The object doesnt contain the Automation object 'ILLA2530.' "

Interestingly, ILLA2530 is the correct lookup that I want inserted into the
combo. Not sure if it makes any difference, but Im using the builder, not VBA.

Regards
Andrew

"Brent Spaulding (datAdrenaline)" wrote:

> I would suggest that you create the literal string in your criteria of the
> DLookup() ...
>
> If "ID" is Numeric ...
> =DLookUp("[AutoASC]","[RetailerASCList]","ID=" &
> Nz([Forms]![ClaimEntry]![Store],0))
>
> If "ID" is Text ...
> =DLookUp("[AutoASC]","[RetailerASCList]","ID='" &
> Nz([Forms]![ClaimEntry]![Store],"") & "'")
>
> Also, make sure the form is open before you run the macro ..
>
> --
> Brent Spaulding | datAdrenaline | Access MVP
>
> "Andrew P." <(E-Mail Removed)> wrote in message
> news:87771994-2C4E-46C0-9DAC-(E-Mail Removed)...
> > Hi All
> >
> > Im a bit confused as to why Access2007 throws errors back when I use the
> > following statement with set value or set temp var, but is fine with
> > msgbox:
> >
> > =DLookUp("[AutoASC]","[RetailerASCList]","ID=
> > [Forms]![ClaimEntry]![Store]")
> >
> > When it complains, it throws a screen with "Action Failed" and error
> > number
> > 2950.
> >
> > Any help would be great
> > Thanks
> > Andrew

>
>
>

 
Reply With Quote
 
Andrew P.
Guest
Posts: n/a
 
      4th Sep 2008
Hi Tom

I still get the same "Action Failed" screen with the same error number.
Regards
Andrew

"Tom van Stiphout" wrote:

> On Wed, 3 Sep 2008 20:10:04 -0700, Andrew P.
> <(E-Mail Removed)> wrote:
>
> Try this:
> =DLookUp("[AutoASC]","[RetailerASCList]","ID=" &
> [Forms]![ClaimEntry]![Store])
>
> -Tom.
> Microsoft Access MVP
>
>
> >Hi All
> >
> >Im a bit confused as to why Access2007 throws errors back when I use the
> >following statement with set value or set temp var, but is fine with msgbox:
> >
> >=DLookUp("[AutoASC]","[RetailerASCList]","ID= [Forms]![ClaimEntry]![Store]")
> >
> >When it complains, it throws a screen with "Action Failed" and error number
> >2950.
> >
> >Any help would be great
> >Thanks
> >Andrew

>

 
Reply With Quote
 
Andrew P.
Guest
Posts: n/a
 
      8th Sep 2008
Hi All

Not sure how I thought of this, but got it going this morning!! - just
needed to include quotes before and after the dlookup.
="'" &
DLookUp("[AutoASC]","[RetailerASCList]","ID=[Forms]![ClaimEntry]![Store]") &
"'"
-----------------------------------------------
"Andrew P." wrote:

> Hi Tom
>
> I still get the same "Action Failed" screen with the same error number.
> Regards
> Andrew
>
> "Tom van Stiphout" wrote:
>
> > On Wed, 3 Sep 2008 20:10:04 -0700, Andrew P.
> > <(E-Mail Removed)> wrote:
> >
> > Try this:
> > =DLookUp("[AutoASC]","[RetailerASCList]","ID=" &
> > [Forms]![ClaimEntry]![Store])
> >
> > -Tom.
> > Microsoft Access MVP
> >
> >
> > >Hi All
> > >
> > >Im a bit confused as to why Access2007 throws errors back when I use the
> > >following statement with set value or set temp var, but is fine with msgbox:
> > >
> > >=DLookUp("[AutoASC]","[RetailerASCList]","ID= [Forms]![ClaimEntry]![Store]")
> > >
> > >When it complains, it throws a screen with "Action Failed" and error number
> > >2950.
> > >
> > >Any help would be great
> > >Thanks
> > >Andrew

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code for Msgbox Chris D Microsoft Excel Programming 5 2nd Jun 2008 09:37 PM
VBA code for MsgBox Chris D Microsoft Excel Programming 7 2nd Jun 2008 07:32 AM
Msgbox Code Help Please.... =?Utf-8?B?a213aGl0dA==?= Microsoft Excel Misc 5 21st Sep 2006 01:52 AM
Code for MsgBox =?Utf-8?B?VGltTg==?= Microsoft Excel Programming 3 5th Sep 2006 05:53 PM
VBA code using if then and msgbox snoopy Microsoft Excel Misc 0 1st Dec 2005 08:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:16 AM.