bounding buttons to tables

alice

Registered User.
Local time
Today, 16:05
Joined
Mar 23, 2010
Messages
27
how do you bound buttons to tables? i have a add new button which i would like to bound to a table so that information in textboxes are added to the table.
 
You only bind tables to forms and controls to fields in the tables.

Use the Row Source property of a form to define the table or query that is to be bound to the form.

Use the Control Source property of a control (textbox, combo box, listbox, etc.) to bind a field from the bound table or query to the control.
 
So you want to add the contents of text boxes in your form to a table? Is the form's record source the table you want to add records to? If it is, put "docmd.gotorecord acnewrec" in the on click event of your button (Check the help file under "gotorecord" for syntax, or alternatively use the wizard).

If the form isn't bound to the table you'll need to use an update or append query depending on what you want to do.
 
james,

i tryed the marco and it says the marco doesnt exist or the marco is new but hasnt been saved.

i dont know what to do
 
Oh sorry, you need to put the statement in VBA.

Try creating a new button, using the wizard, it will take you through the process.

Or you could just use the new record button at the bottom of the form, where it says "record x of y", there's a little button that looks like a right arrow with a star next to it. That does the same thing.
 
how do you put the statment in VBA and i cant find that button am using access 2003 btw
 
Yep, it should be there. So, go to form design view. Right click on your button, click properties. In the window that opens, click the event tab. Scroll down until you see one called on click. Click in the text box there, delete whatever's in there then click the 3 dots button which should appear to the right. Click that, then select "code builder". That opens the VBA editor, then put your code in between "..._Onclick" and "end sub" - but be sure to check the syntax of "gotorecord" in the help file.
 
ther isnt a onclick i put it before end sub but it didnt work
 
There's always an on click event for buttons.

Try creating a new button from scratch and using the wizard as per previous post.
 
i did anyway it doesnt do anything its just a button i click it and nothing happens i created it using the wizard still does nothing
 

Users who are viewing this thread

Back
Top Bottom