Create a costumized button identicle to the built-in new record bu

  • Thread starter Combo box type - help
  • Start date
C

Combo box type - help

Hi.. I would like to know how i can program an event procedure in VBA to one
button to work exactly as the built in "next record" button does.. or to make
it simple i will explain..
I have a form with some input fields.. after fulfilling them i want to press
the "button" i create and i want those values to be sent to the respective
fields in the table (the form is bound to the table).. I want it to do it
everytime. Everytime i press the button the new values i wrote on the input
fields are sent to the table..incresing that way the database data..
Please i'm really having trouble with this..help!
Thanks
 
S

strive4peace

Hi (what is your name?)

Is your form BOUND to a recordset? If not, are you seeking a way to save
the values to your table and clear the screen? If not, why not?

If so...

'~~~~~~~~~~~~~~~
here is code to go to the next record:

'first save the current record
if me.dirty then me.dirty = false

'go to a new record
DoCmd.RunCommand acCmdRecordsGoToNext

'~~~~~~~~~~~~~~~

here is code to go to a new record:

'first save the current record
if me.dirty then me.dirty = false

'go to a new record
DoCmd.RunCommand acCmdRecordsGoToNew

'~~~~~~~~~~~~~~~

for better understanding of the basics of Access, download and read this:

Access Basics on Access MVP site
http://www.accessmvp.com/Strive4Peace/Index.htm
8-part free tutorial that covers essentials in Access

Warm Regards,
Crystal

*
:) have an awesome day :)
*
 
C

Combo box type - help

Hi again, i'm Nuno.. Thanks for your help!
I dont know exactly what you mean with "Is your form BOUND to a
recordset?".. i'll explain what i did right from the start..
I created a table with the fields i want to fill and save for database..
After that i created a form where i bound those fields to input text and
combo boxes.. now what i want is to have a button that checks if every input
box is filled and if so to send the values to respective table fields..
Hope you understand me.. :/

In spite of this i think the code you gave me worked perfectly.. now i have
another problem.. When i repeat the values on the input boxes bound to the
primary key fields on the table, access is showing me the obvious predefined
error message, as it was expected (being the primary key).. i would like to
integrate in my code a msgbox that shell appear everytime i repeat the
primary key fields (they are two - month and year) in spite of that access
error.. i think i need to run the table for those values and if they are
there already the Msgbox("Report already made!") opens..
i dont know how to do it.. help please..
My best regards
Nuno Medeiros

"strive4peace" escreveu:
 
Top