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!

Change in "yes/no" field in database

Status
Not open for further replies.

osp001

Technical User
Nov 19, 2003
79
US
I need some help in doing a one-time-only inventory change to my database.

I'd like to create a form that, when a given number is entered, a field with a "yes/no" data type associated with it is changed from "no" to "yes." In other words, when number "1234" (container:table_containers) is entered, another column in that row (present:table_containers) is changed from "no" to "yes."

1233 no
1234 no
1235 no

And entering "1234" into the form changes the table contents to:

1233 no
1234 yes
1235 no

Could anyone suggest how I might do this? I'd appreciate the help. Thanks!
 
You can use an Event Procedure to do this on a form.

For example,
AfterUpdate for the control (i.e., text, list or combo box), you can set the boolean value to yes. Other possible event procedures to consider may be BeforeUpdate the record and the OnCurrent record event.

What I am not sure about is how you retrieve your data, or what action you are doing when you want to change the boolean value to yes.

For example, let's say you retrieve a record using a combo box. The AfterUpdate event for the combo box retrieves the selected record and then sets the yes/no boolean field to yes.

Assumptions:
cmbSelectID - is the combo box, and accepts a numeric value
YourID - the primary key for the record, and a control on the form uses the same name

Code:
If Nz(Me.cmbSelectID, 0) Then
   Me.Filter = "YourID = " & Me.cmbSelectID
   Me.FilterOn = True
   Me.YourYesNo = Yes
End If

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top