Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

RecordSet.FindFirst

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephanie - 28 Mar 2007 01:57 GMT
Hi. I have a combo box to find an exiting member:

Private Sub CmbSearch_AfterUpdate()
   ' Find the record that matches the control.
   Me.RecordsetClone.FindFirst "[ContactID] = " & Me![cmbSearch]
   Me.Bookmark = Me.RecordsetClone.Bookmark
   Me!cmbSearch = Null
End Sub

The user uses the combo box to locate a member and if the member doesn't
exist, receives an Access box: the test you entered doesn't exist.

Then the user clears out the combo box field and clicks on the new record
button and receives a run-time error 3077: syntax error (missing operator) in
expression.
Debug takes me to:
Me.RecordsetClone.FindFirst "[ContactID] = " & Me![cmbSearch]

How can I gracefully (without an error msg) let the user enter a new record
after the combo box was unable to find an existing record?

Thanks for your input!
Carl Rapson - 28 Mar 2007 16:26 GMT
You need to test for a Null value in your combo box:

If Not IsNull(Me![cmbSearch]) Then
   Me.RecordsetClone.FindFirst "[ContactID] = " & Me![cmbSearch]
   ' ...
End If

The problem is, the AfterUpdate event is firing after you clear the combo
box, but there is no value to use in the FindFirst call.

Carl Rapson

> Hi. I have a combo box to find an exiting member:
>
[quoted text clipped - 20 lines]
>
> Thanks for your input!
Stephanie - 28 Mar 2007 18:42 GMT
You are fabulous! Thanks for the help.

> You need to test for a Null value in your combo box:
>
[quoted text clipped - 32 lines]
> >
> > Thanks for your input!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.