I have an A97 application that I am modifying. I have created an
unbound form, "zfrmTestEnterPlacements", with a subform,
"zsfrmSelectPlacement". The intent is to use a combo box on the
primary form to look up 'exhibitor-entry' data and populate a few
fields on this form. The EntryID(number-long data type) will be
passed to a textbox on the subform. The user will then use a combo
box on the subform to look up the appropriate 'placement' for that
entry and select it. All of this works fine. I then want the EntryID
and PlacementID saved in a table, "wtblEntries-Placement". This is
where the trouble starts. This table's design is as follows:
Field Name Data Type
ID AutoNumber (Long)
EntryID Number (Long)
PlacementID Number (Integer)
When my 'save' button is clicked I receive Error 3251, "Operation is
not supported for this type of object.". I go into debug and this
line is hi-lited: .FindFirst "[EntryID] = " & lngEntryID & "And
[PlacementID] = " & intPlacementID.
Here is the code for the 'save' button:
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_Routine
'variable captures procedure name that error occurs in
strProcname = "cmdSaveRecord_Click"
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("wtblEntries-Placement")
With rst
.FindFirst "[EntryID] = " & lngEntryID & "And [PlacementID] =
" & intPlacementID
If .NoMatch Then
.AddNew
!EntryID = lngEntryID
!PlacementID = intPlacementID
.Update
Else
MsgBox "This Entry ID and Placement have previously been
entered." & vbCrLf & "A duplicate record is not allowed." _
& vbCrLf & "This date will be cleared from the form",
vbInformation + vbOKOnly
txtEntryID = ""
cboSelectPlacement.Value = ""
End If
End With
rst.Close
Set rst = Nothing
Exit_Routine:
Exit Sub
Err_Routine:
Select Case Err
Case Else
Err_General
End Select
Resume Exit_Routine
End Sub
The subform combo(cboSelectPlacement) has a Row Source SQL statement
returning 3 fields with the bound column being column(0), which is the
PlacementID field. This PlacementID field coming into the combo box
is a number(integer) data type.
I am using variables in my FindFirst because I got Error 13 "type
mismatch" messages when I used the controls on the subform. The
variables pick up their values in the cboSelectPlacement_AfterUpdate
event. Can someone explain where this error (3251) is coming from and
what the solution is?
Thanks for any assistance,
Alex