Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch error

Status
Not open for further replies.

Fonzie

MIS
Feb 16, 2001
74
CA
What I am trying to do is for the given part number in a subform, a query will run to add all quantities in all workorders for that part number. I have the code entered below, but keep getting a 'Type Mismatch' error. I have no idea where to go from here.

Private Sub Quantity_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
Dim rst As Recordset
Dim db As Database
Dim strsql As String
strsql = "SELECT Sum(WorkorderDetails.Quantity) AS temp FROM WorkorderDetails WHERE PartNumber = '" & Me!PartNumber & "';"
Set db = CurrentDb
Set rst = db.OpenRecordset(strsql)
rst.MoveFirst
If rst!temp > 1 Then
MsgBox ("More that One")
Else
End If
rst.Close
End Sub
 
What version of Access are you using and what line does the error occur on? Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Using Access 2000. The error occurs on line:

Set rst = db.openrecordset(strsql)
 
The problem has to do with Access 2000 trying to use the ADO library instead of DAO. Open the code window and select references from the 'Tools' menu. Check the Microsoft DAO Library (if it is not already checked) and move it higher than the ADO library. Now your code should run. Mike Rohde
rohdem@marshallengines.com
"If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top