How do I update a cell in a table once exiting a Form

  • Thread starter Thread starter Adrian Laboy via AccessMonster.com
  • Start date Start date
A

Adrian Laboy via AccessMonster.com

I have a query that generates a list on a combobox. The list is stored in a table.
Table:
ID Used
IAS1 No
IAS2 No
IAS3 No
..
..
..
Once sombody selects one of the ID's I want the used cell to change from No to Yes....I tried the update command but for some reason it does not accept it. Can anyone help me ????
 
In the AfterUpdate event of your combobox you can try the following:

Private Sub Combo12_AfterUpdate()
Dim v_SQL As String
v_SQL = "Update tblCodes Set Used = ""Yes"" Where ID = """
v_SQL = v_SQL & Me.Combo12 & """"
DoCmd.RunSQL v_SQL
Me.Combo12.Requery
End Sub

Change the code above to reflect the actual name of your combobox.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Adrian Laboy via AccessMonster.com said:
I have a query that generates a list on a combobox. The list is stored in a table.
Table:
ID Used
IAS1 No
IAS2 No
IAS3 No
.
.
.
Once sombody selects one of the ID's I want the used cell to change from
No to Yes....I tried the update command but for some reason it does not
accept it. Can anyone help me ????
 
Thanks a lot....it worked....but when it tries to add the record it gives me a error:
It says that it can't update the record due to a type conversion failure.

The type of the field in the table is a Yes/No
And the value I'm entering is True........I also tried creating a boolean temp with a value of True.........but it did not work....any comments?
 
Back
Top