Alternative to a Msgbox?

JCShort

Registered User.
Local time
Today, 18:12
Joined
Aug 29, 2008
Messages
35
Is there a function that acts like a Msgbox, but instead of prompting the user to click "OK", the user will have to choose "Yes" or "No"? Answering "Yes" would continue the input, while answering "No" would undo the input.

My problem is that a primary key (or multiple primary keys) aren't needed in my table. When a user adds a new record using a form, I want to run a Dlookup to see if a record already exists for that customer. If another record already exists, I want the user to be able to decide whether he/she needs to add the new record or whether he/she can simply update the previous record. It's hard to explain, but sometimes a new record is absolutely needed and sometimes it's not.

When the user adds a record, I want a Msgbox-like pop-up that reads:
"[SoandSo] already completed this record on [Date]. Do you want to continue to add a new record?"
 
you can use a msgbox with options (among others)

okcancel

or

yesno

-------
you can add a critical, exclamation, information, question symbol, and make any button default


if msgbox("do you want to continue",vbyesno+vbquestion+vbdefaultbutton2,"confirm Action")=vbno then
etc
 
This is a sample of code I use to capture the user's response to a message box. You could use vbYesNo instead of vbYesNoCancel

Te Response variable captures the Yes, No or Cancel selected by the user.

Dim Response As String
strmsg = "Select Yes to save your entry and exit" & Space(20) & _
vbCrLf & " " & _
vbCrLf & "Select No to exit without saving your entry" & _
vbCrLf & " " & _
vbCrLf & "Select Cancel to return to the screen"
Response = MsgBox(strmsg, vbYesNoCancel + vbDefaultButton3 + vbInformation, "Close Screen")

Select Case Response
Case vbYes
do something

Case VbNo
do something else

End Select
 
Wow! I'm a complete tool. A simple Microsoft Office Help search would have clearly explained this. Sorry for wasting your time.

I asked a peer if Msgbox had additional functionality & he said "No", so I ran with it.

Lesson learned. Thanks for helping!! Not to mention, I like building my arsenal of code Poppa Smurf.
 

Users who are viewing this thread

Back
Top Bottom