Re: Saving User Entered Data
ok i just figured out a cheap way of saving the data when they close the form (which isnt the main form), by just hiding it when they close, instead of unloading. i still need to save the data to a database for when they close the program completely to still save the entered data if anyone can help with that. thx,
-frank
Re: Saving User Entered Data
Here's what we will do, create a database in Access (or with the datadesigner), add a table called "Scripts", which has 3 columns (i will call them Column1, Column2 and Column3). Place the database is the same folder as the project. Add a ADO Control (ActiveX Data Objects control) to the form, you probably need to add it via the project>components menu.
' general declaration section
private cnn as ADODB.Connection
private rst as ADODB.Connection
private Sub Form_Load()
' open connection to database
set cnn = new ADODB.Connection
cnn.provider = "Microsoft.Jet.OLEDB.4.0"
cnn.open App.Path & "\scripts.mdb"
' open the recordset
set rst = new ADODB.Recordset
rst.Open "SELECT * FROM dbo_tblWerknemers", cnn, adOpenKeyset, adLockOptimistic
' bind the fields to the data control
set Text1.DataSource = Adodc1
set Text2.DataSource = Adodc1
set Text3.DataSource = Adodc1
' vind the fields to a specific field
Text1.DataField = "Column1"
Text2.DataField = "Column2"
Text3.DataField = "Column3"
' finally, attch recordset to control
set Adodc1.Recordset = rst
End Sub
What this code does is it opens a recordset, and binds it to the form. This way, you don't need to do the saving and loading stuff yourself. You can see that by pressing the datacontrol, you cannavigate through the recordset, without any code.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Re: Saving User Entered Data
thanks, i will have to install Access tomorrow and will try out your suggestion, looks like it should work for what i need. Thanks a bunch for the info :)
(will post tomorrow sometime letting you know if it works out as it should)
-frank
Re: Saving User Entered Data
The Visual Datamanager is supplied with VB, which can also be used to create the database, this doesn't require you to install Access. It can be found in the Add-ins Menu.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Re: Saving User Entered Data
ok I found the DataManager, but I dont understand how that works. I am more familiar with Access. I don't even see a place to add tables using the DM, lol. I've never even seen that before. Oh well, I will just try it with Access, I think that it will work once I install and make the .mdb. thanks for the help,
-frank