PDA

View Full Version : Is it possible to create a message box based on a check box using vba in access?



wedd
10-10-2011, 04:58 AM
Hi everyone, I have a table in access that has 2 checkbox columns called is available and isn't available. I've created a form, on this form I've written the following click event on a command button (listed below): based on the check boxes selected in the table I would like the user to click on the command button...then an inputbox pops up and the user will then type in location, room and date and then a message box will display based on the checkboxes checked and unchecked in the table: whether it's available or not. I've tried the follwoing code but I'm not sure wheteher it's correct...I am only a vba beginner so if you do know any websites that may have a solution or you may have a sample code to do this interesting problem that would be very useful for me to understand vba.

Is this possible to do? If so, what code would I need to do this? I'm a beginner - so any samples would be very useful.

Thanks for your contributions :friends:

Here's is a sample of the code i wrote to resolve the issue: But Im not sure it is correct or displaying exactly what I want. Have a look and maybe you could adapt it to what I want it to do.


Private Sub Command9_Click()
Dim SearchAndDisplayABooking
SearchAndDisplayABooking = InputBox("Enter the date to check if it's available")
MsgBox "This booking is available on " & DateDiff("yyyy", SearchAndDisplayABooking, _
Date) & "date."




End Sub