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?
> 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?
> 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
> > 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?
> 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?
> 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?
> 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?
> 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?
> 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?
> 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?
> 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?
> 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?