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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing values in a table

Status
Not open for further replies.

osp001

Technical User
Nov 19, 2003
79
US
I have a relatively straightforward task I'd like to do, and can't figure out how to do it. Programming isn't my forte, so- bear with me.

Let's say I have a table with two columns. One is for item numbers, and another is for their status (expressed as a number). So, it looks like this:

Item Status
101 4
102 4
103 5
104 3
105 4
106 5

I would like to create two types of forms. The first would change the status of any item number that was entered to a "1." So, enter "101" and the status changes to "1" for that item. And so forth, down the line.

The second type of form would allow me to enter two numbers: one for the item, and the second for the status I would like to change it to. So, enter "101" and then "1", and the first line changes to 101 and 1.

I can do this with a query, but the query then asks me if I'm *sure* I want to change those items, and that gets in the way of entering data for hundreds of items!

Any help would be appreciated. Thanks!
 
Hi
You can set the warning off, under Options, Edit / Find tab, Action Queries checkbox, if you wish. Although it can be unsafe, it would save getting into programming. Not that there would be much involved in the above. Which way would you prefer to go?
 
Well, I do use some queries that are pretty dangerous, and having the warning on them is pretty important. So- programming it is.

But there's no simple and straightforward way to do this without a query?
 
Hi
You could set up a form with two text boxes, one for Item and one for status, both unbound. Then you could code the AfterUpdate event of txtItem to read something like:
Code:
Dim rs as Recordset
Set rs=CurrentDB.Openreccordset("MyTable")
rs.Findfirst "Item=" & Me!txtItem
If rs.NoMatch Then
  MsgBox "Not found"
Else
  rs.Edit
  rs!Status=Me!txtStatus
  rs.Update
End If
I have not tested this, so there may be syntax errors. It is just an idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top