Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [VB6][Access] (https://thetfp.com/tfp/tilted-technology/55258-vb6-access.html)

John Henry 05-11-2004 06:34 AM

[VB6][Access] Adding records to a databasde
 
I am using the code below to try and put some records into a database. It runs through all the code without reporting any errors, but for some reason it won't work. When I view the table it's supposed to be editing, there's nothing but a couple of 0s in a couple of fields. Any ideas?


Private Sub cmdAdd_Click()

Dim strDbName As String
Dim dbDatabase As Database, rsProperty As Recordset
strDbName = App.Path & "\EstateAgent.mdb"
Set dbDatabase = DBEngine.Workspaces(0).OpenDatabase(strDbName)
Set rsProperty = dbDatabase.OpenRecordset("properties")

rsProperty.AddNew

rsProperty!Property_ref_no = txtPropertyRef.Text
rsProperty!Cl...

rsProperty.Update

rsProperty.Close
dbDatabase.Close

End Sub

Edit: I've just spotted that the fields which are coming up as 0 are the ones which are being read from the comboboxes, so something is obviously going in there.

I also tried adding a record from within access, then writing a similar bit of code to this to read it. That didn't work either.

magua 05-12-2004 07:28 PM

I'm confused. Are you unable to write code to read from this database, either?

Also, have you stepped through the code to make sure that the fields in the recordset are actually being set to the values you think they are -- is it possible they are legimitately being set to a bunch of empty strings and zeroes?


All times are GMT -8. The time now is 10:01 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76