Saving records on a form via code 
Author Message
 Saving records on a form via code

Hi,

I've come across a bit of a problem.

In Access 97 I've developed a shipping system. These shipmnents are checked
against an existing order to check that the shipment information matches what
was actually ordered (quantity, etc). If there is a mismatch then I'm popping up
a little window for the user to make a note in to explain why there was a
difference.

This seems to work fine if the shipment record has already been saved.

However, these checks are also done when the shipment record is being input (a
lot of the default information is pulled through from the order). When the
record hasn't been saved and this note window is brought up, the note isn't
being saved.

The note field is called via code in the shipment form, a the shipment ID is put
into one of the note fields - to link them together.

The only solution that I can think of is to save the shipment record before
displaying this note field. Can this be done via code - I can't seem to find it.

TIA

Richard



Fri, 24 Nov 2000 03:00:00 GMT  
 Saving records on a form via code

If you go through the buttons wizard you will find one for saving records...
If you look at the code bihind the button you create it will show the
following:

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

I use it all the time.

hope it helps,

BradC

Quote:

>Hi,

>I've come across a bit of a problem.

>In Access 97 I've developed a shipping system. These shipmnents are checked
>against an existing order to check that the shipment information matches
what
>was actually ordered (quantity, etc). If there is a mismatch then I'm
popping up
>a little window for the user to make a note in to explain why there was a
>difference.

>This seems to work fine if the shipment record has already been saved.

>However, these checks are also done when the shipment record is being input
(a
>lot of the default information is pulled through from the order). When the
>record hasn't been saved and this note window is brought up, the note isn't
>being saved.

>The note field is called via code in the shipment form, a the shipment ID
is put
>into one of the note fields - to link them together.

>The only solution that I can think of is to save the shipment record before
>displaying this note field. Can this be done via code - I can't seem to
find it.

>TIA

>Richard



Fri, 24 Nov 2000 03:00:00 GMT  
 Saving records on a form via code

RunCommand acCmdSaveRecord should work.

Alden

Quote:

>Hi,

>I've come across a bit of a problem.

>In Access 97 I've developed a shipping system. These shipmnents are checked
>against an existing order to check that the shipment information matches
what
>was actually ordered (quantity, etc). If there is a mismatch then I'm
popping up
>a little window for the user to make a note in to explain why there was a
>difference.

>This seems to work fine if the shipment record has already been saved.

>However, these checks are also done when the shipment record is being input
(a
>lot of the default information is pulled through from the order). When the
>record hasn't been saved and this note window is brought up, the note isn't
>being saved.

>The note field is called via code in the shipment form, a the shipment ID
is put
>into one of the note fields - to link them together.

>The only solution that I can think of is to save the shipment record before
>displaying this note field. Can this be done via code - I can't seem to
find it.

>TIA

>Richard



Fri, 24 Nov 2000 03:00:00 GMT  
 Saving records on a form via code

The standard
    RunCommand acCmdSaveRecord
saves the *current* form, so is not suitable.

Instead use the Refresh method for your other form.
At the top of your code:
------------------------------------------
Dim frm As Form
Set frm = Forms![MyOtherForm]    'Error if not open.
If frm.Dirty Then
    frm.Refresh
End If
Set frm = Nothing
------------------------------------------

Quote:

> In Access 97 I've developed a shipping system. These shipmnents are checked
> against an existing order to check that the shipment information matches what
> was actually ordered (quantity, etc). If there is a mismatch then I'm popping up
> a little window for the user to make a note in to explain why there was a
> difference.

> This seems to work fine if the shipment record has already been saved.

> However, these checks are also done when the shipment record is being input (a
> lot of the default information is pulled through from the order). When the
> record hasn't been saved and this note window is brought up, the note isn't
> being saved.

> The note field is called via code in the shipment form, a the shipment ID is put
> into one of the note fields - to link them together.

> The only solution that I can think of is to save the shipment record before
> displaying this note field. Can this be done via code - I can't seem to find it.

  ,~,_/\
 /      \   Allen Browne
{ Perth  }  Australia
 *_,~~\_/   http://odyssey.apana.org.au/~abrowne/
       v


Sat, 25 Nov 2000 03:00:00 GMT  
 Saving records on a form via code

If the shipment record value exists at the time the note is called and the
note is in a separate table there is no reason why it should not be saved.
If someerror then
 open a box and
 with rst
  .addnew
  .noteID = XXXXX
  .note = enteredtext
 end with
end if
I've seen some cases where it *seems* that the value XXXXX can't be
Me!ShipID
If you set a variable to the value and use this variable it works.

(A spell check with outlook on someerror offers a hat full of other
solutions.)

Quote:

>However, these checks are also done when the shipment record is being input
(a
>lot of the default information is pulled through from the order). When the
>record hasn't been saved and this note window is brought up, the note isn't
>being saved.

>The note field is called via code in the shipment form, a the shipment ID
is put
>into one of the note fields - to link them together.

>The only solution that I can think of is to save the shipment record before
>displaying this note field. Can this be done via code - I can't seem to
find it.

>TIA

>Richard



Sat, 25 Nov 2000 03:00:00 GMT  
 Saving records on a form via code

Quote:

> Hi,

> I've come across a bit of a problem.

> In Access 97 I've developed a shipping system. These shipmnents are checked
> against an existing order to check that the shipment information matches what
> was actually ordered (quantity, etc). If there is a mismatch then I'm popping up
> a little window for the user to make a note in to explain why there was a
> difference.

> This seems to work fine if the shipment record has already been saved.

> However, these checks are also done when the shipment record is being input (a
> lot of the default information is pulled through from the order). When the
> record hasn't been saved and this note window is brought up, the note isn't
> being saved.

> The note field is called via code in the shipment form, a the shipment ID is put
> into one of the note fields - to link them together.

> The only solution that I can think of is to save the shipment record before
> displaying this note field. Can this be done via code - I can't seem to find it.

> TIA

> Richard

G'day Richard
Try
me.dirty = false
(Who said I was adirty old man?)
--
  ,-._|\    John Carter

 \_,--.x/   Melbourne Victoria Australia.
       v


Sun, 26 Nov 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. removing code from a document created via code and save as

2. Creating Records in a Second Table ... via Code

3. Active X form to save data into MS-Access via web

4. Using code to save a record

5. Saving records using Code

6. Saving record in a sub form

7. Problem with Saving Record & opening form

8. How to save current record in sub-form?

9. Closing a Form without Saving the Record

10. Automatically Save Records in Form

11. How: Save a Form's current record using VBA/DAO

12. Switching between Datasheet and Form views via code

 

 
Powered by phpBB® Forum Software