omg Access drives me crazy

  • Thread starter Thread starter VitoCorleone
  • Start date Start date
V

VitoCorleone

Guest
Hi,
Run-time error 13:
Type mismatch

i get this error on the bolded part of my code:

Private Sub Form_Open(Cancel As Integer)
Dim a, b As Single
Dim c As String
Dim d As Double

Dim dbBank As Database
Dim tKonta, tRodzaj, tOp As Recordset

Set dbBank = CurrentDb

Set tRodzaj = dbBank.OpenRecordset("Rodzaj konta", dbOpenSnapshot)
Set tKonta = dbBank.OpenRecordset("Konta", dbOpenDynaset)
Set tOp = dbBank.OpenRecordset("Operacje kasowe", dbOpenDynaset)

a = Format(Now, "dd")
b = 0

If a <= 7 Then
...and so on...

tried lots of things, and have no idea what's wrong, maybe someone could help me out with that?

thx in advance!
 
Again... 'tOp' may be a hazardous object name...
 
thx, but the 'tOp' was originaly 'tOperacje'
i've changed it earlier to check if it could be the problem...

any ideas?
 
Dim tKonta, tRodzaj, tOp As Recordset
only dims tOp as record set the others are variants.


try
Set tOp = dbBank.OpenRecordset("Operacje kasowe")
 
in fact if you are running A2K or above you will probably need to set a reference to DAO
then dim as DAO objects

Dim dbBank As dao.Database
Dim tKonta As dao.Recordset, tRodzaj As dao.Recordset, tOp As dao.Recordset
 
While the Variant will take the form of a Recordset it is best as Bat7 says to dimension as a Recordset.

The problem with the Type Mismatch, however, is most likely that you have an ADODB reference as the default instead of a DAO reference. [Read this]
 
thx every one,
i dont know shit about dao/ado, but i changed:
Dim tKonta, tRodzaj, tOp As Recordset
to
Dim tKonta, tRodzaj, tOp
according to what bat17 suggested and it seems to be working right now :)
lets hope it won't come up with a problem later...

anyway thx
 
Read the link I gave you. You have set up implicit references while explicit references would be more appropriate.
 

Users who are viewing this thread

Back
Top Bottom