DCount stopped working (1 Viewer)

monfas

Registered User.
Local time
Today, 20:39
Joined
Jun 18, 2012
Messages
32
Can anyone tell me what's wrong with this code? '

It worked fine before, but for some unknown reason is not counting records anymore. This is to see if is there any record departing on the same date that is the text box ETD_Txt, and if so, will open a second form Everything is stored in the table tMov.

I don't know if I changed anyproperty in any of the tables, or indexes, so I also someone can tell me why it stopped working, I would appreciate... I hope is not a bug on my pc.
.:banghead:

I tried several things, but noting makes it work.

Private Sub mov_Click()

If DCount("movid", "tmov", "etd =#" & Me.ETD_Txt.Value & "#") Then

DoCmd.OpenForm "fmov_1"

Else:
Me.Text16.Value = Me.ETD_Txt.Value & "_" & Left(Me.TypeTransport, 3) & DCount("movid", "tmov", "etd =#" & Me.ETD_Txt.Value & "#") + 1 & "_" & Me.movFromCounty.Value & "-" & Me.movToCounty.Value & "_" & Left(Me.typetransport_txtbox.Value, 2)
End If
end sub

Thanks
 

G37Sam

Registered User.
Local time
Today, 21:39
Joined
Apr 23, 2008
Messages
454
We don't have enough information to determine where the error is coming from. The syntax seems fine.

Test out DCount on its own first before running the entire code. You may have mis-spelled a field or table name
 

monfas

Registered User.
Local time
Today, 20:39
Joined
Jun 18, 2012
Messages
32
I tested and didn't work... it gives 0, where should give 2 or 3...

I will go to a previous version of my db and see if it works there... would be any problem in the registry? or in a bug in the Access?

I had another problem this morning with a recordset that was not opening, I went a copied the same form, with the same code from a previous version of the DB, and started working.

I am still trying to solve it, if I solve it and I know what I did, I will let you know.


Cheers and thanks guys.
 

Users who are viewing this thread

Top Bottom