473,385 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.RunCommand acCmdSaveRecord
Me.refresh
If me.dirty then
me.dirty=false
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 frmSelectService, but have not saved the record.

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

Code below:

Private Sub cmdAddService_Click()
On Error GoTo Err_cmdAddService_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.txtDropOff) Then
MsgBox "Please enter the drop off date for the items on this
order"
DoCmd.GoToControl (txtDropOff)
GoTo Exit_cmdAddService_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.RunCommand (acCmdSaveRecord)

' Me.Refresh

lngOrderID = Me.txtOrderID
stDocName = "frmSelectService"

stLinkCriteria = "[OrderID]= " & lngOrderID

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdAddService_Click:
Exit Sub

Err_cmdAddService_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
order"
Me.txtDropOff.SetFocus
GoTo Exit_cmdAddService_Click
End If

MsgBox Err.Number & " " & Err.Description
Resume Exit_cmdAddService_Click

End Sub

MANY thanks.
sara

Jan 22 '06 #1
0 1445

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

Similar topics

4
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...
20
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...
2
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...
8
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...
6
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...
3
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...
4
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...
2
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 =...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
1
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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 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.