I have a form with 3 textboxes, combo1, and 5 option buttons, what i would like to do is save the info into a database.
Inside the database there is 7 fields - but for now i would like to just save 5 to the database:
Name | Qty | Status | Type | Spice
i have a module called "ModData" and in it is the following, but i really don't know how to use it..
but i have seen it used to save data into a database like:Code:Public db As Database Public rs As Recordset Public ws As Workspace Public Function InitDB(TableName As String, DataFile As String, DataIndex As String) Set ws = DBEngine.Workspaces(0) Set db = ws.OpenDatabase(App.Path & "\" & DataFile) Set rs = db.OpenRecordset(TableName, dbOpenTable) rs.Index = DataIndex End Function Public Function SelectData(TableName As String, TableCol As String, TheData As String) Set rs = db.OpenRecordset("SELECT * FROM " & TableName & " WHERE " & TableCol & "='" & Replace$(TheData, "'", "''") & "'") End Function
Code:rs.AddNew rs("Game Name") = Text1 rs("Company") = Text2 rs("Year") = Text3 rs("Cartridge ID") = Text4 rs("Rarity") = Combo1.Text rs("Own") = Text5 rs("Qty") = Text6 rs("Notes") = Text7 rs("Value") = Text8 rs("Label") = Text9 rs.Update




Reply With Quote