run-time error 3077 no apostrophes!!!

G

Guest

OK, every post I've seen on this error has involved apostrophes, but mine
doesn't. I am using a combo box to look up members and the bound colum is an
autonumber field, so no special characters!

On de-bug I mouse over the cboFindmember in the code and it says
"cboFindmember = empty", even though a record was selected in the cbo box

code below is on the "search" button on my form which brings up a dlg box
for this search

thanks for any suggestions

Private Sub cmdFindmember_Click()

fconfirm = False
DoCmd.OpenForm "dlgfindmember", , , , , acHidden

Dim dlg As Form
Set dlg = Forms!dlgfindmember


dlg!cboFindmember = Null
dlg!cboFindmember.SetFocus

dlg.Visible = True

On Error GoTo searcherr
Do
DoEvents
Loop Until Not dlg.Visible
On Error GoTo 0

If Not fconfirm Then Exit Sub
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "member_no = " & cboFindmember
If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark
Exit Sub

searcherr:
If Err <> OBJECT_NO_LONGER_EXISTS Then
MsgBox Err & " " & Error
End If
End Sub
 
B

Brendan Reynolds

You forgot to put "dlg!" in front of cboFindmember in the following line ...

rst.FindFirst "member_no = " & cboFindmember

If you were using Option Explicit, you'd get an error message that the
variable cboFindmember was not defined, but because you are not using Option
Explicit, VBA will implicitly create a varaible of type Variant with that
name. A Variant to which no value has been assigned has the special value
Empty, which is what you're seeing when you mouse over the variable name in
break mode.
 

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

Top