Question : i'm getting a "RUNTIME ERROR 3167", plz help!


This DB had been in use for over a year without many problems. Now, for some reason, I'm getting a runtime error 3167.
When a new record is being entered, the user first inserts the customer's phone number. Then when that text box looses focus, a dCount function counts the number of times that phone number is in that field and displays the number in a txtVisit text box. This enables us to track the number of visits we've been to that customer's site. This always worked fine but in the last few days everytime someone is creating a record that has 2 or more visits, we get the error "runtime error 3167,
record is deleted". I cant figure it out so far. Debugging highlights the line:
varVisit = DCount("[NewEuPh]", "tblNEW", "[NewEuPh] = txtEuPh")
which is what counts the visits. Then I have a series of IF statements like this:
If varVisit > 0 Then
    If varVisit = 1 Then
        txtVisit = "2nd Visit"

Any ideas would be great! thnx!!

TAZ :-)

Answer : i'm getting a "RUNTIME ERROR 3167", plz help!

did you copy this line of code?

varVisit = DCount("[NewEuPh]", "tblNEW", "[NewEuPh] = txtEuPh")

shouldn't this be

varVisit = DCount("[NewEuPh]", "tblNEW", "[NewEuPh] = " & txtEuPh)

you may want to compact and repair....back up the database first.

Mike

Random Solutions  
 
programming4us programming4us