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 / May 2007

Tip: Looking for answers? Try searching our database.

cmdSearch_Click

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tmaxwell - 07 May 2007 14:04 GMT
I am trying to use a cmdSearch command button. I have a query that I built
the form page from and I need the ability to type in a part number and have
the cmdSearch find the record. The query is named PARTSEARCH and the part
field is 2nditemnum as MODEL. Please take a look and let me know why this
won’t run. I can give more detail.

Option Compare Database

Private Sub cmdSearch_Click()
   Dim strPARTSEARCHRef As String
   Dim strSearch As String
   
'Check txtSearch for Null value or Nill Entry first.

   If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
       MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criteria!"
       Me![txtSearch].SetFocus
   Exit Sub
End If
'---------------------------------------------------------------
       
'Performs the search using value entered into txtSearch
'and evaluates this against values in strStudentID
       
   DoCmd.ShowAllRecords
   DoCmd.GoToControl ("2NDITEMNUM AS MODEL")
   DoCmd.FindRecord Me!txtSearch
       
   str2NDITEMNUM AS MODEL As 2NDITEMNUM AS MODEL.SetFocus
   strPARTSEARCHRef = str2NDITEMNUM AS MODEL.Text
   txtSearch.SetFocus
   strSearch = txtSearch.Text
       
'If matching record found sets focus in strStudentID and shows msgbox
'and clears search control

   If strSEARCHRef = strSearch Then
       MsgBox "Match Found For: " & strSearch, , "Congratulations!"
       str2NDITEMNUM As MODEL.SetFocus
       txtSearch = ""
       
   'If value not found sets focus back to txtSearch and shows msgbox
       Else
           MsgBox "Match Not Found For: " & strSearch & " - Please Try
Again.", _
           , "Invalid Search Criterion!"
           txtSearch.SetFocus
   End If
End Sub

Private Sub txtSearch_BeforeUpdate(Cancel As Integer)

End Sub
tmaxwell - 07 May 2007 14:19 GMT
> I am trying to use a cmdSearch command button. I have a query that I built
> the form page from and I need the ability to type in a part number and have
[quoted text clipped - 49 lines]
>
> End Sub
 
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



©2009 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.