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

  • Thread starter Adrian Laboy via AccessMonster.com
  • 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 ????
 
L

Lynn Trapp

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 ????
 
A

Adrian Laboy via AccessMonster.com

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top