Insert Data... Urgent Please

Haytham

Registered User.
Local time
Today, 23:40
Joined
Jun 27, 2001
Messages
162
Hi All...
I created my db and put the Data Backend in the server, and my Frontend in user's PC.
The problem is that :
Some of my forms are Bound, so only one user can enter, modify ... the data.
Some advices is to create Bound Form and then Push (Insert) data by CmdButton into my table, to avoid this conflict.
I can create Bound Form with specific Fields accordingly.
My problem is how to insert data into my data to the table.
I've never used it before, so expecting a help from you programers with many thanks...
 
Ok, I think you are talking about UNBOUND forms....

Take the form that is now bound, remove it's datasource, and for each field remove the control source.

Say you want to squirt the contents of controls txtName and txtDateAdded to a new record in a table called tblStaff, to fields called Name and DateAdded.

this is how:

Private Sub ctlSubmit_Click
Dim rst as Recordset
Dim db as DataBase
set db = CurrentDb

set rst = Db.OpenRecordset("tblStaff", Db.OPenDynaset)

With rst

.Addnew
!Name = Me!Name
!DateAdded = Me!DateAdded
.Update
.close

end with

End Sub
 
Hi Jimbob, thank you for reply.
Well, I tried to put the code as mentioned with changed according to my field name, but
set rst = Db.OpenRecordset("TableName", Db.OPenDynaset) gives me error in OpenDynaset
I don't how to declare the variable...
Expecting more help from you.

Hi Pat, Thank you..
Ok. Every user have a copy of Application db front end linked to the Data backend in the server successfully.
They all have the right to open, delete, modify according to theil level.
When any user open his copy, .ldb is created which can't be deleted. But it disappear (Deleted) when they shut down their copy in the right direction.
The db is opened in a shared mode with No Locks.
Still this problem arise.
 
Should be

set rst = Db.OpenRecordset("TableName", DbOpenDynaset)
 
Thanx Fizzio...

Has that fixed it Haytham?
 
No.. I'm getting Run Time Error 13
Type Mismatch.
 
Do you have accecc '97? if so, go to the debug window, tool, references...check your references are like so:

Visual Basic for Applications (Ticked and at the top of the list)

Microsoft 8.0 Object Library (ticked and second on the list)

Microsoft DAO 3.51 Object Library]

Has that sorted it? or do you have Acess 2000?
 
If you are using Access 2000, you should include as one of your references "Microsoft DAO 3.6 Object Library".
 
Sorry, DAO 3.6 Object Library is already ticked.
Anyway I'll try to fix it.
Thank you
 

Users who are viewing this thread

Back
Top Bottom