Macro vs If Statement

Yam84

Registered User.
Local time
Today, 12:57
Joined
May 20, 2008
Messages
16
Good Afternoon,

I have a form created that is used to check items in and out. If an item is checked out, they have 1 day to check it back in. i would like create a macro or use an IF statement to generate a msgbox to let the user attempting to check something out, who currently has something checked out already, to receive a message telling them they can't check out somthing until they have returned whatever they have checked out.

I tried to do it using a macro w/ this code:
Condition: IsNull([checkInDtAcc])
Action: MsgBox
Arguments: You will not be able to check out an item until you have returned all previously checked out items.,Yes, Information, Return Checked Out Item

I want this to display when they try to check something out, so on the form in the field which creates a new record for that person, in the event tab before Update i put the name of the macro. I am sure I haven't done something, as I can add a new record and the message does not pop up, even tho the ([checkInDtAcc]) is null.

Should I be trying to use a macro to accomplish this? or should I use an IF statement? if I should use an if statement, how will I format it? i tried to create my own but none worked.

Thank you
 
use [Forms]![yourformname]![checkInDtAcc] Is Null in your condition.

VBA can be like this...

Private Sub Command83_Click()

Me.txtCheckinDate.SetFocus
If Me.txtCheckinDate.Text = "" Then

MsgBox "You will not be able to check out an item until you have returned all" & vbNewLine & _
"previously checked out items.,Yes, Information, Return Checked Out Item", vbInformation

End If

End Sub
 
thank you for this response...Should I place it in the before update section of my text box?
 

Users who are viewing this thread

Back
Top Bottom