Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 05-11-2004, 06:34 AM   #1 (permalink)
Addict
 
Location: Grey Britain
[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.
__________________
"No one was behaving from very Buddhist motives. Then, thought Pigsy, he was hardly a Buddha, nor was he a monkey. Presently, he was a pig spirit changed into a little girl pretending to be a little boy to be offered to a water monster. It was all very simple to a pig spirit."

Last edited by John Henry; 05-11-2004 at 07:36 AM..
John Henry is offline  
Old 05-12-2004, 07:28 PM   #2 (permalink)
Tilted
 
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?
magua is offline  
 

Tags
vb6access


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 03:37 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, 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