Save function for adding new records in a form

Franny

New member
Local time
Today, 09:47
Joined
Nov 24, 2006
Messages
3
Hi guys and girls,

I'm fairly new to Access and I'd appreciate some help. I've built a form with buttons to open new forms for that specific record (based on queries as all the data is held in a single table). This works fine until I try to add new records. At the moment the only way I can make this work is to add the new record, shut the original form before re-opening it and proceeding on to the other sections (via the buttons I mentioned).

If anyone could tell me how to get Access to save the record before it opens the other forms I'd really appreciate it.

Cheers,
Franny.
 
Put this code with the code that opens your other form. Put it before the DoCmd.OpenForm etc


Code:
DoCmd.RunCommand acCmdSaveRecord

Example of how it would be used;
Code:
Dim stDocName As String

Dim stLinkCriteria As String
    
   [B] DoCmd.RunCommand acCmdSaveRecord[/B]

    stDocName = "frmProjectDetails"
    
    stLinkCriteria = "[ProjectID]=" & Me![ProjectID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Thanks a lot Ansentry. That's solved the problem.
 

Users who are viewing this thread

Back
Top Bottom