Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
SQL = "update tblGroupAndMembers set group_id = '" & !group_id & "' where member_id = '" & memberId & "'"
I keep getting 'Data type mismatch in criteria expression.' If i hard code memberId then I dont get the error. I dont understand what I am doing wrong. i defined memberID as Integer. The data Type for member_id in the tblGroupAndMembers table is number with field size integer. Can someone please help?
This line is in the following code:
With rstMemberId
SQL = "insert into tblGroupAndMembers(member_id) values('" & !member_id & "')"
db.Execute SQL
memberId = !member_id
.Close
End With
Set qdfTemp = db.CreateQueryDef("", _
"SELECT group_id FROM tblGroupNames WHERE group_name = '" & cmbGroupName & "' ")
Set rstGroupId = qdfTemp.OpenRecordset()
With rstGroupId
SQL = "update tblGroupAndMembers set group_id = '" & !group_id & "' where member_id = '" & memberId & "'"
db.Execute SQL
.Close
End With