how do I update records

  • Thread starter Thread starter Afrosheen
  • Start date Start date
A

Afrosheen

I need to update a field in a record using the "On Click Button". This is
what I'm trying to do. I know there's an SLQ routine I can use but I'm doing
this in VB.

if status = "working" and shift = "A" then -- {this is the criteria I have.}
{I need to replace the status field in all the records with "Off Day"}
replace status with "Off Day"
endif

I'm sorry, I'm new to this and I don't know the coding for this. Some one
suggested to use the Udate command, but that wouldn't work.

I hope I've explained myself.

Thanks
 
Are you working with an individual record in a bound form, or are you wanting
to run a query against all records?
 
Why wouldn't an Update Query work? It's exactly the kind of thing this was
designed for.
It SOUNDS as if you want to replace each example of the word "Working" with
text "Off Day" if Shift = "A".

If Yes, then a) you can use an Update query, b) Create a Status table and
replace the Status field with StatusID - The primary key of the Status table
so that next time you want to change a text field, you can just change it
once in your Status table

As a general guide, if you are typing something repeatedly (A B C, Working,
Off Day) then there is a high probability that you need a linking table.

The VB for doing this sort of thing is relatively simple but unless your
explanation is completely unclear, why would you go to the trouble of
learning how to write it when you are clearly unfamiliar with it.

Evi
 
Back
Top