I have a Microsoft Access 7.0 database that I built from the Vis.. Data Manager. I also have another form with textboxes. I'm having troubles adding the textboxes data into the database automaitically.
Look into the Data control. You should be able to bind it a table in your database and then you should be able bind the text boxes to the data control.
Do a search on this site for the 'datacontrol' or the 'adodc' and you should get some results.
Try adding the following line at the end of your code.
frmtrans.data1.recordset.update
Whenever you are working with a recordset and you are editing or adding a new record then you have to update it in some way for it to be written to the database. The syntax will depend on what tools you are using but the logic remains.
1. get record (new or existing)
2. make changes
3. update database Thanks and Good Luck!
I also thought about using the "INSERT" statement to insert record in my access database. Do you know how to write the codes? In case you do please help me do so.
I just finished some testing using an ADO data control. I don't usually use bound controls so I had to refresh my memory. It is found in Project-components, select Microsoft ADO Data Control 6.0. I added the ADODC to a form and bound it to an Access database and set the command type to adcmdtable and the recordsource to the table I wanted. I set the EOFAction property to adDoAddNew.
I then added the required number of text boxes and bound them to the ADO data control and the specific field. The control allowed me to browse the records in the database and when I reached the end of the recordset (EOF) it allowed me to add a new record. This record was added when i moved to the previous record. So far no code was written.
I added a button to add a new record and placed the following code in it.
Private Sub cmdAdd_Click()
Adodc1.Recordset.AddNew
End Sub
This emptied my text boxes so I could add a new record and when I moved to a new record the information was saved.
Seems to me that if you bind your text boxes then you don't have to reference them when you add a new record. I also have the following code in a save button. It commits the new record and then keeps the new data in the bound text boxes.
Private Sub cmdSave_Click()
Adodc1.Recordset.MoveLast
End Sub
I hope that this is more helpful. If you want I can send you my small test project, just email me at zemanpw@hotmal.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.