Auto update checkbox in table onclick

racha0601

New member
Local time
Today, 05:29
Joined
Mar 9, 2012
Messages
6
Hi, please help!

I am a beginner to VB so please excuse my poor programming.

I have an 'Equipment' table with a field 'Available' which has a checkbox assigned, the default value is 'Yes' (checked).

I then have a 'Submit' button within a 'Loan' form. I would like it so that when the button is clicked the 'Available' checkbox automatically changes to 'No' (un-checked).

Is this possible?

I have tried the following:

Private Sub Submit_Click()

Update Equipment
Set Available = 0

End Sub

No surprise, it doesn't work!

Any ideas?

Thanks, Rachael
 
Hi, please help!

I am a beginner to VB so please excuse my poor programming.

I have an 'Equipment' table with a field 'Available' which has a checkbox assigned, the default value is 'Yes' (checked).

I then have a 'Submit' button within a 'Loan' form. I would like it so that when the button is clicked the 'Available' checkbox automatically changes to 'No' (un-checked).

Is this possible?

I have tried the following:

Private Sub Submit_Click()

Update Equipment
Set Available = 0

End Sub

No surprise, it doesn't work!

Any ideas?

Thanks, Rachael



Code:
Private Sub Submit_Click()
 
Currentdb.Execute "Update Equipment Set Available = 0"
 
End Sub

Of course this will set all the "Available" fields in your table to No, if you want a specific record to change you need to add a where clause and the criteria to identify which record is no longer available.
 
Thanks DJkarl!

You're right I am going to need a where clause :(

Looks like its back to the drawing board!

Do you know how I can get it to change for only the item they have selected to loan? The field they select is Equipment ID.

Thanks again,

Rachael
 
Last edited:

Users who are viewing this thread

Back
Top Bottom