Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
VBA Compile Error: Variable not defined
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Duncs  
View profile  
 More options Nov 6, 5:30 pm
Newsgroups: microsoft.public.access
From: Duncs <true.kilted.s...@gmail.com>
Date: Thu, 5 Nov 2009 22:30:55 -0800 (PST)
Local: Fri, Nov 6 2009 5:30 pm
Subject: VBA Compile Error: Variable not defined
I'm trying to write a piece of SQL code for to be executed within a
VBA module.  My SQL code is as follows:

"UPDATE tblActionDetails SET StatusId=" & stsWorkable & " WHERE
StatusId=" & stsLocked & " AND " & _
"#" & Format(Now(), "dd/mm/yyyy") & "# >= #" & DateAdd("d", 7, Format
(DateLocked, "dd/mm/yyyy")) & "#;"

Values are:

StatusID is a field in the table tblActionDetails
stsWorkable is a public enumerated set to 1
stsLocked is a public enumerated set to 2
DateLocked is a field in the table tblActionDetails

What I want to do is set the field StatusID to 1, where it has been
set to 2 for 7 or more days since the date value in DateLocked.

When I compile the code, it gives me the error:

"Variable not defined" and highlights the entry "DateLocked".  What am
I doing wrong?

TIA

Duncs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve Schapel  
View profile  
 More options Nov 6, 6:35 pm
Newsgroups: microsoft.public.access
From: "Steve Schapel" <scha...@mvps.org.ns>
Date: Fri, 6 Nov 2009 20:35:27 +1300
Local: Fri, Nov 6 2009 6:35 pm
Subject: Re: VBA Compile Error: Variable not defined
Duncs,

Well, the basic problem is that you are putting the DateLocked field outside
of the SQL string, and thereby treating it as a variable, which it isnt.

But anyway, you are making it more complicated than it needs to be.  Try it
like this...

"UPDATE tblActionDetails SET StatusId = " & stsWorkable & _
 " WHERE StatusId = " & stsLocked & _
 " AND Date() >= (DateLocked + 7)"

--
Steve Schapel, Microsoft Access MVP

"Duncs" <true.kilted.s...@gmail.com> wrote in message

news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Duncs  
View profile  
 More options Nov 6, 9:11 pm
Newsgroups: microsoft.public.access
From: Duncs <true.kilted.s...@gmail.com>
Date: Fri, 6 Nov 2009 02:11:10 -0800 (PST)
Local: Fri, Nov 6 2009 9:11 pm
Subject: Re: VBA Compile Error: Variable not defined
Cheers Steve.  That's my problem all the time...make things more
complicated than they need to be!!

Duncs

On 6 Nov, 07:35, "Steve Schapel" <scha...@mvps.org.ns> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A2J  
View profile   Translate to Translated (View Original)
 More options Nov 6, 10:14 pm
Newsgroups: microsoft.public.access
From: "A2J" <2jesusbr...@gmail.com>
Date: Fri, 6 Nov 2009 11:14:32 -0000
Local: Fri, Nov 6 2009 10:14 pm
Subject: Re: VBA Compile Error: Variable not defined
esta é uma experiencia

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:36 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:41 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:58 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:35 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:37 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:54 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:43 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rudolf Lamour  
View profile  
 More options Nov 7, 2:43 am
Newsgroups: microsoft.public.access
From: "Rudolf Lamour" <rudolflam...@freenet.de>
Date: Fri, 6 Nov 2009 16:43:38 +0100
Local: Sat, Nov 7 2009 2:43 am
Subject: Re: VBA Compile Error: Variable not defined

"Duncs" <true.kilted.s...@gmail.com> schrieb im Newsbeitrag
news:911ef2ea-1b34-4ae0-aeb4-dc7feeb70db8@f16g2000yqm.googlegroups.com...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google