Hi,
I have a problem I need some help with.
In my Access 2000 database (used for logging complaints to my company), I'm using the following code to send an email to our finance dept when a refund is requested: - Private Sub Save_Record_Click()
-
On Error GoTo Err_Save_Record_Click
-
-
Dim strTo As String
-
Dim strCC As String
-
Dim strSubject As String
-
Dim strBody As String
-
Dim FirstFile As String
-
-
-
If RefundStatus = "sent" Then
-
MsgBox "THIS REFUND HAS ALREADY BEEN SENT - LOG NOT SAVED"
-
Exit Sub
-
Else
-
End If
-
-
If Confirmation = -1 Then
-
strCC = "email@provider.com"
-
Else:
-
strCC = ""
-
End If
-
strTo = "email2@provider.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 *"
The finance report is created using a query where the details are retrieved using "MaxOfRefNumber " where RefNumber is an autonumber. This is causing problems when a second user starts logging a complaint after the first user, but saves before the first does, or when a user starts logging a complaint, partially completes the form, then has to log a second call and go back the original record. In these cases the details from the wrong record are being retrieved for the finance report.
Crunch time: Is there a way I can retrieve the details for the CURRENT record, rather than the record with the highest reference number?
Any help gratefully received.
Many thanks,
Olly
4 1798 Rabbit 12,516
Recognized Expert Moderator MVP
Rather than using the max reference number, have the query/report use the current reference number from your form. It can be called using the format Forms!FormName! ControlName
Thanks Rabbit,
Where do I do this? I'm not used to referencing forms in queries/reports.
Cheers,
Olly
In fact, don't worry I have worked out myself that I can create a new report and use this syntax directly on the report (which makes my query redundant!)
Thanks for your help rabbit, much appreciated!
Rabbit 12,516
Recognized Expert Moderator MVP
Not a problem, good luck.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul Wagstaff |
last post by:
Hi there
I have 2 tables: tblAccuracy & tblClearance
Users add new records to tblAccuracy using frmRegister. Under specific
conditions I need to append the current record from frmRegister into
tblClearance. I was thinking of placing the code on the form's BeforeUpdate
event so that it will fire whether the user closes the form or attempts to
create another record.
|
by: Willem |
last post by:
Hi there,
I'm sort of new with doing much record manipulation with queries. Up
till now I've been programming VBA and doing record looping to get my
results. This works fine but tends to get very, very slow as the
number of records grows - somewhere in the number of 5,000,000. I
imagine queries are much faster but am not quite sure if queries will
do the trick.
My problem:
|
by: JC Voon |
last post by:
Hi All:
I'm new in Threading and Web Services, can someone please verify my
code, i'm not sure whether this is the correct way, althought it is
partially work, but some time it will raise exception at FillDatatable
dr.AcceptChanges, and also the XTraGridControl will not response when
click on the column header to do sorting and filtering.
What i'm trying to do is very simple, i just want to retrieve a very
large table from web service...
|
by: Wade |
last post by:
I am pretty new to Access, especially writing code, but I found code on the web to do just what I want and it is posted below. It returns a field value from a previous record. I found the code at: http://support.microsoft.com/?kbid=210504; many of you have probably seen this code. I have an Access form and a query, both based on exactly the same table, a simple two field table with an ID field and a field of consecutive numbers in consecutive...
|
by: kepston |
last post by:
I have a situation where I need to record scrap quantities for parts that we sell and parts that are supplied, in a single table. I have a UNION query that combines the part numbers successfully, allowing the user to select from a combo box without knowing whether the part is supplied or manufactured. I need to provide a DEFAULT value for cost (which, if changed later would not be wrong). To do this, I would like to pull the price from the...
| |
by: Andy_Khosravi |
last post by:
Background: Access 2003 (converted from A97 DB recently), database is
split into FE/BE with the FE residing on client machine.
I've got a question about how I can possibly optimize a query I've
built. This may seem relatively straight forward to some of you more
experienced programmers, but I'm almost entirely self-taught. This
means that I have some gaps in my knowledge and sometimes go about
doing things the hard way never knowing...
|
by: Michel Esber |
last post by:
Hello,
Db2 Linux LUW FP 15.
Consider table A (ID varchar, EXECUTION_DATE date).
a) I want to first retrieve all IDs that have not executed during the
last 90 days:
select distinct ID from table_B where NOT EXISTS
|
by: jmarcrum |
last post by:
Hey everyone,
I have a question that's been troubling me for a bit. I work for Alabama Power. I have 1 table (tblOutages). Every morning I import a list of Power Outages for the state of Alabama into that table. I have a yes/no (chkOutage) field set-up in the table to set chkOutage = TRUE on every record that is imported.
Here's my question, and it's a bit long. :) I would be much appreciative if anyone could help!
At the end...
|
by: shalskedar |
last post by:
In a query i want to retrieve the value in such a way that if the value for the current record for a given column is 0 then it should go
to the next record & take the value.
for ex-I 've column Payment received in the query.I want to retrieve the value in such a way that if the current record value for this column is 0 then it should go to the next record value..
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |