Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write in Access table with VBA

Status
Not open for further replies.

FreeJim

Programmer
Jul 26, 2001
7
CH
Hello !

A little problem today...

I have to write and read data in a recordset in a table.

I have do this :

Dim dbsDB As Database
Dim rst1 As Recordset

Set dbsDB = OpenDatabase("C:\Gestion_Remicom.mdb")
Set rst1 = dbsDB.OpenRecordset("T_OBJ")

Do Until rst1.[EOF]
With rst1
.AddNew
.Update
End With
Loop

And I've got the message : Type uncompatibility

Could anyone help me ?

Thanks in advance !
 
It sounds like the data that you are trying to store into a field is not the same as the type of the field you are trying to store it into. Any chance you are trying to put characters into a number field or a text string that looks like '01/01/2001' into a date field? Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Just a quick guess but what are you adding here.

With rst1
.AddNew
.Update
End With

There needs to be some code between addnew and update
!field(1) = "this" and the data added needs to match the what you have set up for the field.

another thing to look at, are your references OK
 
Just a note, The code seems to loop continuosly due to every new record never reaching the EOF.
 
I don't know if this applies or not, but if you are using Access 2000, you need to make sure that the DAO library reference has a higher priority than the ADO. To do this, open your code window. Under the Tools menu, select references. Make sure the DAO library is checked and has a higher priority than ADO. Here is the microsoft article on it:

Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top