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 2005

Tip: Looking for answers? Try searching our database.

msg box code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RipperT - 31 Mar 2005 10:48 GMT
Hello,

I've used the combo box wizard to create a combo box that looks up records.
It's after_update event code looks like this:

Private Sub Combo16_AfterUpdate()
   ' Find the record that matches the control.
   Dim rs As Object

   Set rs = Me.Recordset.Clone
   rs.FindFirst "[InmateId] = '" & Me![Combo16] & "'"
   If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

What could I add to generate a message box that says "record was not found"

Many thanx,

Ripper

Signature

Ripper T Smith
rippertsmith<nospam>@comcast.net

Douglas J. Steele - 31 Mar 2005 11:54 GMT
If Not rs.EOF Then
  Me.Bookmark = rs.Bookmark
Else
  MsgBox "Record was not found"
End If

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hello,
>
[quoted text clipped - 16 lines]
>
> Ripper
Dirk Goldgar - 31 Mar 2005 17:44 GMT
> If Not rs.EOF Then
>    Me.Bookmark = rs.Bookmark
> Else
>    MsgBox "Record was not found"
> End If

But if this code is an an MDB file, not an ADP, you need to check the
NoMatch property instead of EOF (no matter what the wizard says):

   If rs.NoMatch Then
       MsgBox "Record was not found"
   Else
       Me.Bookmark = rs.Bookmark
   End If

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
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.