Hello,
I have created an access database to log complaint calls to my company. Sometimes these will result in a refund request being sent to our finance dept.
I have an event procedure which will send an email via lotus notes to the finance dept. when the Save button on the form is clicked.
I also have a Search (Find) button on the form so that users can look up previous complaints if necessary (which it sometimes is).
My problem is this:
If a user uses the search facility to find a record which has resulted in a refund request and clicks the Save button again, the refund request would be sent through to finance again (they shouldn't, but I'm trying to make this idiot-proof!).
Is there any way to prevent this from happening?
Many thanks,
Olly
6 3609
Hello,
I have created an access database to log complaint calls to my company. Sometimes these will result in a refund request being sent to our finance dept.
I have an event procedure which will send an email via lotus notes to the finance dept. when the Save button on the form is clicked.
I also have a Search (Find) button on the form so that users can look up previous complaints if necessary (which it sometimes is).
My problem is this:
If a user uses the search facility to find a record which has resulted in a refund request and clicks the Save button again, the refund request would be sent through to finance again (they shouldn't, but I'm trying to make this idiot-proof!).
Is there any way to prevent this from happening?
Many thanks,
Olly
It seems to me Olly that you simply need to add an additional piece of logic there and that is this:
If the 'status' of the record is flagged as 'refund email sent' either in a hidden field (if you think this is more appropriate for you) or a field 'visible' to the user and they understand the relevance of. Then a test could be applied to that value within the 'on click' event for the mail send.
I don't know what you have used there specifically for sending the mail via lotus notes but within that code if you are able to say that the email was 'actually sent' at the end of its program flow you could then simply update the status field of your table to 'email sent' and test against that value when the user clicks the 'Save' button something like this - IF Me!Status="Refund Email Sent" Then
-
'do nothing because an email has been sent for a refund
-
ELSE
-
'the code that fires to send the mail and if sent sucessfully
-
'update the status field to read email sent and then save
-
END IF
-
I cannot see your program flow so obviously this is pure method guesswork and might even be more appropriate in the forms 'before update' event, it depends on what program flow you have there. It assumes of course you can add an extra field to your table to act merely as a status flag for the record.
Regards
Jim :)
Thanks Jim,
That makes perfect sense. I was thinking down completely different lines, but I think your idea will work just fine. Thanks for your help.
Olly
Thanks Jim,
This works just great. Problem is solved with 5 or 6 lines of code and I'm a happy man.
Olly :)
Thanks Jim,
This works just great. Problem is solved with 5 or 6 lines of code and I'm a happy man.
Olly :)
Good you post your final code? Thanks!
-
If RefundStatus = "sent" Then
-
MsgBox "THIS REFUND HAS ALREADY BEEN SENT - LOG NOT SAVED"
-
Exit Sub
-
Else
-
End If
-
-
If Confirmation = -1 Then
-
strCC = "xxxx@xxxx.com"
-
Else:
-
strCC = ""
-
End If
-
strTo = "xxxx@xxxx.com" strSubject = "Refund"
-
strBody = "Refund for authorisation"
-
FirstFile = "h:\financereport.rtf"
-
-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
-
-
-
-
If Refund_Amount > 0 Then
-
-
If fIsAppRunning = False Then
-
MsgBox "PLEASE LOG ON TO LOTUS NOTES BEFORE TRYING TO SEND REFUND REQUEST" & Chr$(10) & " *REFUND NOT SENT*"
-
Exit Sub
-
Else
-
End If
-
-
-
DoCmd.OutputTo acOutputReport, "FinanceReport", acFormatRTF, "H:\financereport.rtf"
-
-
SendNotesMail strTo, strCC, strSubject, strBody, FirstFile
-
RefundStatus.SetFocus
-
RefundStatus.Text = "sent"
-
DoCmd.GoToRecord , , acNext
-
MsgBox "REFUND REQUEST HAS BEEN SENT TO FINANCE" & Chr$(10) & " * LOG SAVED, THANK YOU *"
-
-
Else
-
RefundStatus.SetFocus
-
RefundStatus.Text = "N/A"
-
DoCmd.GoToRecord , , acNext
-
MsgBox "* LOG SAVED, THANK YOU *"
-
End If
-
N.B. I posted that at 5pm yesterday on my way out of work and didn't get chance to tidy up the indents etc. Sorry if it looks a bit messy, but it works!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: titan nyquist |
last post by:
I thought I need something like this, but it turns out I don't. I'm
still interested if this can be done:
Can you do a multi-thread "lock", that locks out everything else, all
other threads,...
|
by: Samuel R. Neff |
last post by:
When is it appropriate to use "volatile" keyword? The docs simply
state:
"
The volatile modifier is usually used for a field that is accessed by
multiple threads without using the lock...
|
by: Curious |
last post by:
I have an arraylist used in three separate methods.
In method #1 (event method), some items are removed from the arraylist
if certain conditions are met;
In method #2 (event method),...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |