Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Update

Status
Not open for further replies.

kimtp

Programmer
Jun 15, 2002
310
0
0
US
Am trying to perform a batch update (reset records to '' or Null) on my database. Have figured out how to do that with alpha/numeric fields but am having trouble with boolean. What I have so far is:

cn.Execute "Update mytablename" & _
" Set myfldname = Null" 'or
" Set myfldName = ''"

When I do the same for a boolean field, the field does not change in the database if it is checked.

Any help is appreciated.

Thanks

Kim
 
if boolean in db then null or "" wont change anything, bool values are by default regarded as false, so try updating the bool fields to false instead of null
 
Thanx for the response. Should have mentioned that I had tried = False. Doesn't do the job.

Kim
 

Try...
[tt]
SQLString = Update MyTableName Set MyFieldName = " & False
[/tt]

Notice the false outside of the string so you are not passing "False" but the value of false which is 0 (zero).

Good Luck

 
Don't need a sql string for this batch update and when I tried what you suggest I get a data type mismatch error.

Kim
 
I have two tables and just discovered that setting the value to either Null or False in one table works but not in the other. Here is the code for both:
cData.Execute "UPDATE Attending" & _
" Set numAttend = Null,MealAmount = Null, SouvenirNum = Null," & _
" SouvenirAmount = Null, GiftAmount = Null," & _
" Deceased = NULL, MailLabel = NULL, Souvenir = NULL"

cData.Execute "UPDATE Members" & _
" SET EventName = '', EventNum = Null, EventAmount = Null," & _
" EventAttend = False"

The Update Members works, Attending does not. It is a puzzle to me.

Thanx.

Kim
 
Disregard all of this. Setting the boolean to either False or Null clears the check box in Access. My powers of observation need some honing. And this before the first homebrew.

Thanks to all for your input.

Kim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top