Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2004-11-12
3
Medium Priority
?
1,219 Views
Last Modified: 2011-04-14

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 :-)
0
Comment
Question by:tazlastic
3 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 12571527
Dim lCount as long
lCount =  cLng(DCount("[NewEuPh]", "tblNEW", "[NewEuPh] = " &  txtEuPh))

or if NewEuPh is a text field (in the table) then
Dim lCount as long
lCount = clng(DCount("[NewEuPh]", "tblNEW", "[NewEuPh] = '" &  txtEuPh & "'"))

Just one conversion too now :-)

0
 
LVL 18

Accepted Solution

by:
Data-Man earned 2000 total points
ID: 12571544
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

0
 

Author Comment

by:tazlastic
ID: 12571619

omg, you rock, I'm retarded, cant believe I didnt try that. Compact and repair did the trick. Thanks data-man! thnx for our input too flavo!

TAZ :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Beware when using the ListIndex and the Column() properties of a listbox in Access 2007.  A bug has been identified in the Access 2007 listbox code which can cause the .ListIndex property to return a -1, and the .Columns(#) property to return a NULL…
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question