Syntax problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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 & "'"
 
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 & "'")

.
 
Back
Top