Link to home
Start Free TrialLog in
Avatar of J G
J G

asked on

message box in access

I am using the following vba for a message box in access.   If the user hits OK, I want a new sub form to open.    If the user hits Cancel, I want to  reset/reopen existing form. What is wrong with my VB?

Function Message()
Dim MSGBOXRSP As Integer

MSGBOXRSP = MsgBox("Item Not Found.  Add new item?", vbOKCancel)

If LResponse = vbOK Then
  (Open New Subform)
Else
(Reopen/ResetCurrentForm)

End If
End Function
SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J G
J G

ASKER

Thanks! I used the code below:

Function Message()

Select Case MsgBox("Item Not Found.  Add new item?", vbOKCancel)
Case vbOK:

Case Else

 DoCmd.OpenForm "Item_Master"
 
 
End Select


End Function
you're welcome

is this a combobox?
do you need help with a  NotInList procedure?