473,385 Members | 1,400 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 button on form not working properly

Hi all. Hoping to get some help here. I have created the form and it is linked to the correct table. I want to use the "save button" to save the data to the form. Once saved, I want the form on the screen to clear and move on to the next available ID number. I have combed through this forum, but can't seem to find a solution to my issue. I have cut and pasted the code I am using....
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub CommandAddNew_Click()
  4. If Me.NewRecord Then
  5. DoCmd.RunCommand (acCmdSaveRecord)
  6. DoCmd.RunCommand (acCmdRecordsGoToNew)
  7. End If
  8. End Sub
  9.  
  10. Private Sub SAVE_FIGHT_RECORD_Click()
  11.  
  12. End Sub
Thanks for any help!
Mar 28 '18 #1
1 3189
NeoPa
32,556 Expert Mod 16PB
Hi Monica.

I'll try to be gentle. I'm guessing you're new to all this.
  1. Never allow any module in VBA to start without an Option Explicit line at the top (Require Variable Declaration). You don't need the extra hassle.
  2. DoCmd.RunCommand acCmdSaveRecord is not the most reliable of commands. I have a routine I use that does that for me as well as documents why it's necessary :
    Expand|Select|Wrap|Line Numbers
    1. 'SaveRec() Saves the current record on frmMe.
    2. Public Sub SaveRec(frmMe As Form)
    3.     'No error handling here.  Should be handled by calling code if required.
    4.     'This code is a little weird but how saving has been implemented in Access.
    5.     frmMe.Dirty = False
    6. End Sub
  3. MonicaJaffe:
    I want to use the "save button" to save the data to the form.
    This doesn't make sense. Forms are objects that allow data to be seen and manipulated. They are not containers of data. The bound table or query is where the data is held (or the table behind the query in that case).
  4. You don't say, but reading between the lines I guess this is a form with the Data Entry property set to True. This means only new records can be selected. If not then it sounds like you may want to set it that way.
  5. Although you indicate you're having problems, you don't actually describe it/any of them.
  6. MonicaJaffe:
    Once saved, I want the form on the screen to clear and move on to the next available ID number.
    I have no idea what you mean by that as I have no information about what you're working with.
With more information we can help more.
Mar 29 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data...
4
by: Charleees | last post by:
GIFS not working properly in JavaScript PopUps Hi all, I have a button and when i click tha button it redirects to another page..... I have also added a java script for the button that...
4
by: freeskier | last post by:
Hello, I am creating a form for data entry. The main form has personal (address, phone) information that is allready stored. the subform has blank fields for information that is being entered. The...
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...
2
by: Eric | last post by:
Hi, I have a form that requires a save button to be clicked before closing the form. I would like a msgbox to pop up when the button is not clicked before closing. Can someone show me how i...
4
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
1
by: QCLee | last post by:
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but...
1
pradeepjain
by: pradeepjain | last post by:
hello, I am using php forms ..i have 2 things tht is when a user fills form he is given a preview button where he previews wht he has filled up till here everything is working fine. ...
14
by: squrel | last post by:
Hello everyone, I m using some button using toolbar such as Add,Save,View,.... my save button is not working.... it doesnt give me any error but does not save to my database.... or showing in my...
1
by: amme | last post by:
i am beginner in MS Access i want to save entries on form(named: MDF) through a save button if form field "Primary Cable" (indexed with other field Primary Cable Pair) have duplicate value then on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.