Syntax problem

D

Desert Bear

In the following code, DCount line goes to the error exit. iMgr is set correctly to the ID number for the manager table. Names have been copied from the tables themselves, so they are correct. parenthesis and quotes are paired

Dim iMgr As Integer 'holds manager I
Dim i As Integer 'holds count of people for that manage

iMgr = Form_frmManagers.cboSelectMgrName.Valu
' Count how many people the manager still has assigned to the
i = DCount("[peoPeopleID]", "tblPeople", "[mgrManagersID] = '" & iMgr & "'"
 
P

Patrick

You might need to remove the single quotes in the
following statement:
"[mgrManagersID] = '" & iMgr & "'")
If mgrManagersID is a integer then you trying to affect a
string to-it. By removing the single quotes it will try to
affect a integer to another integer...

I can't see anything wrong with the rest of your code..
If it doesn't solve the problem, check mgrManagersID's type
and make sure that whatever your affecting to that field
matches exactly type for type...

HTH's,
PAtrick
-----Original Message-----
In the following code, DCount line goes to the error
exit. iMgr is set correctly to the ID number for the
manager table. Names have been copied from the tables
themselves, so they are correct. parenthesis and quotes
are paired.
Dim iMgr As Integer 'holds manager ID
Dim i As Integer 'holds count of people for that manager

iMgr = Form_frmManagers.cboSelectMgrName.Value
' Count how many people the manager still has assigned to them
i = DCount("[peoPeopleID]", "tblPeople", "[mgrManagersID] = '" & iMgr & "'")

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Records Count 2
Dcount expression syntax error 2
Help - Loop within a loop code 3
Dcount Problem 3
Record not saving correctly 3
syntax error 2
Dcount Syntax Problem 5
Form data not refreshing after editing 1

Top