code for SAVE button

Cindy

Registered User.
Local time
Today, 12:27
Joined
Jul 3, 2014
Messages
160
hi, I'm a beginner with VB. The SAVE button on my data entry form saves the data but it does not clear the form afterwards i.e. for the next record to be entered. Could someone advise on the code to do this?:confused:

I created it using the control wizard. Any help is appreciated
 
Do you want it to clear the Form or go to a new record? (I want to make sure I give you the correct line.)
 
hey GinaWhipp. Just to clear the form after saving, and the cursor go to the beginning of the form for the next entry. Thanks much
 
Hmm, then go to a new record... Is this an Embedded Macro or code?
 
I don't have any code for this button. I reckon that Access did whatever it did when I specified, button should save a record. I just need the form details to be cleared after it saves...
 
Cindy,

You're going to need to adjust the Embedded Macro but it sounds like you wouldn't know how. Can you upload the file and I'll add the two lines?
 
hey GinaWhipp, I looked in the event tab for the button and there is nothing in there. How do I get the embedded macro...?:confused:
 
Hmm, there has to be something. Perhaps it says Event Procedure?
 
Please see the attached.
 

Attachments

  • SAVEcode.jpg
    SAVEcode.jpg
    55.9 KB · Views: 99
Umm, that button is doing nothing, what makes you think it's saving?
 
okay not sure what happened dere but this is the embedded code:

OnError
Go to Next
Macro Name
RunMenuCommand
Command SaveRecord

If [MacroError]<>0 then
MessageBox
Message = [MacroError].[Description]
Beep Yes
Type None
Title
EndIf

Please could you also advise on this:
In the attached dbase, the SEARCH button is not working. I also attached a copy of the error message.

As you begin to type in the textbox, it pulls up the list of possibilities in the subform. I end up not using the SEARCH button which is sitting beside it. I have considered getting rid of it but for aesthetic reasons I'll like to keep it.
 

Attachments

I can't get more than one character in the Search Field AND your screen shoot does not look like mine. What did you change prior to sending to me?
 
Added the lines to get it to go to a New Record once you select Save.

As for the Search button, it can't search within the Subform only the Main Form to which it is attached. If you move it to the Subform it should work there. TThe other reason is becuase it goes to the Previous Control which is in the Detail Section and it won't look there (and it's ignoring the Subform). You might do better with an *Apply Filter* macro as that will look at the Record Source to Filter the Form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom