473,837 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save New Record - Tried all from prior posts

I have a simple app, and I'm trying to add Orders.

I have tblOrders and tblOrderDetails .

First, the user selects the customer, then "orders", "new Order"

The frmNewOrder simply assures the user she is on the right customer
and sets up an orderKey and orderNumber.

The user enters "Drop Off date", to make the form dirty, and to have
Access assign an OrderID.

Then the user presses "Add Services to Order".

The problem is that the Order record isn't saved. I've looked at prior
posts from as far back as 2001 and have tried all suggestions:
me.dirty = true
doCmd.RunComman d acCmdSaveRecord
If me.dirty then
I have set the focus to the other control (misc notes) where the user
could enter date.

Nothing works. Some of these attempts have yielded the "can't add -
need a related record in tblCustomer" type message, and others have
taken me to the frmSelectServic e, but have not saved the record.

I am having the same problem on frmSelectServic e. It's bee 2.5 hours
now - maybe someone can help??

Code below:

Private Sub cmdAddService_C lick()
On Error GoTo Err_cmdAddServi ce_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim lngOrderID As Long
Dim dtmDropOffDate As Date

dtmDropOffDate = Me.txtDropOff
' ???*** Prefer to check here, but how???
' This code is not executed it drop off date is empty - only when it's
been filled in
' the error code executes when drop off date is empty
' If drop off date is empty, tell the user to put in the date
' Date is required to get the system to assign an Order ID and save
the record
If IsNull(Me.txtDr opOff) Then
MsgBox "Please enter the drop off date for the items on this
DoCmd.GoToContr ol (txtDropOff)
GoTo Exit_cmdAddServ ice_Click
End If

' Save the order before opening the "add services" form
' Need to force the save - not happening automatically
' This code saves the new record before going to select services form
' If Me.Dirty Then
' Me.Dirty = False
' End If

Me.txtMiscNotes .SetFocus
Me.Dirty = True

DoCmd.RunComman d (acCmdSaveRecor d)

' Me.Refresh

lngOrderID = Me.txtOrderID
stDocName = "frmSelectServi ce"

stLinkCriteria = "[OrderID]= " & lngOrderID

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdAddServ ice_Click:
Exit Sub

Err_cmdAddServi ce_Click:

' If drop off date is empty, tell the user to put in the date
' Date is required to get the system to assign an Order ID and save
the record
If Err.Number = 94 Then
MsgBox "Please enter the drop off date for the items on this
Me.txtDropOff.S etFocus
GoTo Exit_cmdAddServ ice_Click
End If

MsgBox Err.Number & " " & Err.Description
Resume Exit_cmdAddServ ice_Click

End Sub

MANY thanks.

Jan 22 '06 #1
0 1480

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Aliza Klein | last post by:
I am new to ASP so please pardon me if this is crazy. I have data that I want to allow the user to be able to save in a format that will then enable the user to open the data in Excel. (I have already read the previous CSV posts and still have a question.) I have an ASP page that takes some data from a previous page,adds some column headings and displays it all in apparent CSV format. All I am trying to do is allow the users to do a...
by: Greg | last post by:
I'm fairly new to access (using 2002) and am setting up a DB for work. along with each record the user also needs to make a flow diagram (previously, these reports were composed in word and they used the autoshapes to create this diagram). I was wondering what the best way to incorporate this into the DB. I have read about how saving them as pictures in the DB bloats the size, which is unacceptable, but it needs to be easy to do (not...
by: icedgar | last post by:
am using the following script in the BeforeUpdate area of a main form. Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strMsg As String strMsg = "Do you wish to save your changes?" If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then 'do nothing Else
by: ISmith | last post by:
Hi, I am trying to increment a field on a form after a record has been stored. It is a standard fumeric field which may contain some blocks of consecutive values in the table but is not meant to be an auto increment field. I have been trying to store the value of the field in a variable and then me.field +1 but it is not working - what event should I be using to a) store current value, b) increment value on new record ?
by: Ken Mylar | last post by:
I have a dilema here that I'm hoping some one can help me out with. On my forms I have some basic New, Edit, Save, Delete, Undo buttons on them. When first opened all controls on the form are not enabled. When you hit one of the buttons certain controls enable and some don't depending on the function. My dilema is with the New button and in turn the Save button. I would rather the user click the "New" button to add a record instead of...
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The other one is Next button which i created to open another form "frmSummary" which displays back the records submitted. (i used the wizard to open form and find specific records to display. All these works superb until a review by users where they...
by: RAG2007 | last post by:
ADP front end, SQL Server backend. On my main form, I need to pull up in a select query in values from a record I am in the process of adding, before SQL Server actually saves the record to give me the Primary Key ID, which is autoincrement. I've tried docmd.runcommand accmdsaverecord, but it is giving me this: Run-time error '7874': Access can't find the object 'SELECT ((0)) AS Column1, ((0)) AS Column2,((0)) AS Column3,((0)) AS...
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded = strFullFileName. The label would show the file name and when the form was closed and then opened it would still show the name of the last file loaded. That preserves an important piece of information. Suddenly the form has stopped doing that. When you...
by: Neil | last post by:
Was working in A2003 and noticed that the Save Record item on the Records menu was not available when the record was not dirty. In A2000, Save Record was always available. (This is a problem for me because I have Docmd.Runcmd acCmdSaveRecord code all over the place, which never gave an error before. But now it was giving an error when the Save Record menu command wasn't available.) So I went back to A2000 and confirmed that the Save...
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: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.