help with update query

  • Thread starter Thread starter ifoundgoldbug
  • Start date Start date
I

ifoundgoldbug

UPDATE [location Query]

SET [location Query]![Location] = IIf ( [location Query]![updateme] =
True , Forms![Series]![NewLocation] AND [location Query]![updateme] =
False , [location Query]![Location])

FROM [location Query];


as for what I am trying to do. i have a true false column of data for
every record in my database. Each record in this instance is a file
and it's location IE File1 is on c:\file1 and file2 is on D:\file2 now
lets say that I want to burn those 2 files off onto disk and delete
them from my hdds. since the location has changed i would like to be
able to go through all of the files that I am going to burn off and
check updateme then put thier new location (probably a disk number) in
the text box Forms![Series]![NewLocation] and update all of those
entries new locations then set the update me back to false.

apologies for the length

thank you very much for your time
 
UPDATE [location Query]

SET [location Query]![Location] = IIf ( [location Query]![updateme] =
True , Forms![Series]![NewLocation] AND [location Query]![updateme] =
False , [location Query]![Location])

FROM [location Query];

You didn't say what your question is, but your IIf statement looks very
problematic.

The syntax for IIF is

IIf (Condition, value if true, value if false)

Looking at your "value if true" it looks like you are trying to include
the FALSE part within the TRUE part. If NewLocation is a string, this
will almost certainly result in type mismatch.

In any event, it looks like a logic error.

Did you mean

IIf ( [location Query]![updateme] = True ,
Forms![Series]![NewLocation],
[location Query]![Location])

?
 
yes it was about the iif statement and what I wanted is IIf ( [location
Query]![updateme] =
True , --> (these BOTH should happen if it is true) [location
Query]![Location] = Forms![Series]![NewLocation] AND [location
Query]![updateme] = False

essentially I want the true portion of the iif to reset my update me to
false and update the location to the new location specified in
Forms![Series]![NewLocation]
UPDATE [location Query]

SET [location Query]![Location] = IIf ( [location Query]![updateme] =
True , Forms![Series]![NewLocation] AND [location Query]![updateme] =
False , [location Query]![Location])

FROM [location Query];

You didn't say what your question is, but your IIf statement looks very
problematic.

The syntax for IIF is

IIf (Condition, value if true, value if false)

Looking at your "value if true" it looks like you are trying to include
the FALSE part within the TRUE part. If NewLocation is a string, this
will almost certainly result in type mismatch.

In any event, it looks like a logic error.

Did you mean

IIf ( [location Query]![updateme] = True ,
Forms![Series]![NewLocation],
[location Query]![Location])

?
 
Hello ifoundgoldbug,

You can't execute the second update within the IIf.

What you could do is execute a second query to perform the second update.

yes it was about the iif statement and what I wanted is IIf ( [location
Query]![updateme] =
True , --> (these BOTH should happen if it is true) [location
Query]![Location] = Forms![Series]![NewLocation] AND [location
Query]![updateme] = False

essentially I want the true portion of the iif to reset my update me to
false and update the location to the new location specified in
Forms![Series]![NewLocation]
UPDATE [location Query]

SET [location Query]![Location] = IIf ( [location Query]![updateme] =
True , Forms![Series]![NewLocation] AND [location Query]![updateme] =
False , [location Query]![Location])

FROM [location Query];
You didn't say what your question is, but your IIf statement looks very
problematic.

The syntax for IIF is

IIf (Condition, value if true, value if false)

Looking at your "value if true" it looks like you are trying to include
the FALSE part within the TRUE part. If NewLocation is a string, this
will almost certainly result in type mismatch.

In any event, it looks like a logic error.

Did you mean

IIf ( [location Query]![updateme] = True ,
Forms![Series]![NewLocation],
[location Query]![Location])

?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top