Ms Access Search/find Command Button??

I have a MS Access database, and I have set up a form for users to input

name, address, ssn and other data. I have command buttons on the form

to print a record, add a record, delete a record and to exit. I tried the

search option, but with 50k records on a netwoek, it was to slow.

Is there a way to have a search on a command button, (Macro?) on

this form to allow our employees to search by name or ssn?

Thanks for your help.

View Replies


Command Button Search On Access Page - Version: 2003 (11.0)

Here's the scoop

I have an Acess database. In column 1 are numbers, in column 2 are descriptions that contain multiple words.

I created an Access page and saved the HTML file. Users can now view the database via a web browser.

I then wanted to add a search button to that HTML page. I added the Command Button and then.....

From the Microsoft web site I built this into the code:

<SCRIPT language=vbscript event=onclick for=command0>
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
rs.find "Description = '" & cStr(inputbox("Enter a Key Word","Find")) &"'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Product found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark

Now that all works fine, BUT, the description the user enters in has to match EXACTLY what's in the database for it to return any results. I want the user only to enter in a key word.

For example: In the database in the "Description" column there maybe be an entry "Great Oak Tree"

I would like the user to use the command button, enter in just "Oak" and get a results.

Seems easy enough, just need to put a * somewhere in the script......right?


View Replies View Related

Find Record Command Button

I know you can create a find record command button really simply, which when clicked will display the find and replace window.

What i want to do is create a command button that will search a specific field that i specify in a report for the criteria i enter.

i.e i have a customer information form, which contains

Tel etc

what i want is a button that when clicked brings up an input field that allows the user to type the name of the company into this field, then when either the enter key is pressed or another button on this pop up window the matching record will be displayed or a error window stating that there are no matching records. Can anyone help me with this.

View Replies View Related

Command Button Search Function - Version: 2002 (10.0) XP

I have created a an Invoice management data access page for the finance department of my telecommunications company and recently update the DAP with a search button and corresponding script from the MS Access help page (see below)

The problem is, is that I keep on getting a 3265 error stating that the item cannot be found in the collection corresponding to the requested name or ordinal.

The ID field (the field to be searched) is the primary key within the back end of the database system that is used to produce a unqiue identifier in the DAP.

Further to the above, the MS site suggests adding this code to the event name to make the script work, however, it causes a fault when added to the rest of the script.

<SCRIPT for=MSODSC event=Current(0Eventinfo) language=vbscript>

Where am I supposed to add this code and can someone suggest a modification to this code and the code below that will actually work?

The data access page has been grouped on 3 fields, so only one record with the corresponding fields can be viewed at a time.

My email address is

Many thanks in advance all.

Kind regards,


<SCRIPT language=vbscript event=onclick for=Command0>
'<script language=vbscript for=MSODSC event=Current(oEventInfo)>
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
On error resume next
' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "CustomerID = '" &amp; CStr(InputBox("Please enter customer to find", "Find")) &amp; "'"
rs.find "ID = " & cLng(inputbox("Enter an invoice ID","Find"))
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
Exit Sub
End If
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Invoice found",,"Search Done"
Exit Sub
End If
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark


View Replies View Related

Command Button Search Is Not Working - Version: 2003 (11.0)

Issue: The Search cmdbutton on the “frmPFPA Demographics” is not displaying the two subsequent form data. I have attached a sample db. The db opens with [frmPFPA Demographics}, consisting of two subforms {frmPFPA PWP Data} and [frmPFPA PF Testing}. As I scroll forward using the bottom navigational buttons of the main form, each of the 51 individual Demographics and both subforms follow with the individual’s appropriate data that is linked to the two subtables. No problem here. ( Note: tblPFPA Demographics is the main table; the individual may have a PWP activity in “tblPWP Input Data” and not necessarily an activity in “tblPFPA PF Testing”; if there is a record in tblPFPA PF Testing, some records are not complete. tblPFPA PF Testing is not a subtable of tblPWP Input Data. Client Eighteen does not have a PWP activity yet; there are 3 PF Testing activities.)

Issue: when I press the Search cmdbutton on the “frmPFPA Demographics” and locate individual, ie Client Five, I get the Demographic data “tbl PFPA Demographics” only; I do not get the appropriate “tblPFPA PWP Input Data” nor the “tblPFPA PF Testing” data for Client Five or other records. There is 1 PWP record and 7 PF Testing records that belong to Client Five.

I originally had “qryPFPA DemoPWPPF tbls” as the Record Source for “frmPFPA Demographics”. However, when I opened “frmPFPA Demographics”, the “frmPFPA Demographics” would display a total of individual 87 records, the count of the query whereas the count should be 51 Demographic records. The “frmSelect Ind Report” in the db works fine as well as the “frmSpecial DB Reports”! I am wondering if my “frmSelect PFPA Ind” is not set up properly! Any suggestion would be helpful. Thank you!

View Replies View Related

Search Form W/command Button & Two Tables - Version: 2007 (12.0)

Hi all,
I haven't touched Access in almost three years and have forgotten so much , so after searching and reading until my head hurts I wanted to ask what is probably the simplest question you'd face.

I'm trying to build a form to translate a numerical price ($178.55 for example) into the equivalent in Spanish words. The header contains 2 text boxes (dollars and cents) and a command button. The output on the form will consist of three textboxes. 1 and 2 have ones/tens in Spanish ($123= ciento - veintitrés).
That part works. The command button code is:

Private Sub Command4_Click()
End Sub

But I am trying to add a second textbox to the header for the cents (from a second table) which will show up in the third box on the form as the Spanish translation (.18 cents=dieciocho centavos). I have tried a number of solutions, all pertaining to more complex searches, to no avail.
In a nutshell, I need to have the user type in, for example $123.45, click the button and have the output show up in the two textboxes from the dollars table and the cents show up in the next textbox as the cents in the second form.

The solution is probably right in front of me but I'm going nuts with this. Any help would be VERY MUCH appreciated.

View Replies View Related

MS Access Command Button

Hi All,
I have what it most likely a fairly simple question that I'm looking for help on.

I have a MS Access table called "Products". The table has (4) fields called "SerialNumber" "ModelNumber" "ModelName" and "WarrantyDate"

I have created a form called "Warranty Status", the form contains a text box and a command button.
I would like to set it up so a user would type the serial number into the text box and click the button. If the warranty date associated with the serial number shows to be in warranty, I'd like to display the message to say, "you're item is in warranty". If beyond the warranty date, "Sorry, You Are Out Of Warranty"

Any help on the VB code is greatly appreciated!

View Replies View Related

Exporting To Access Using Command Button

Dear All:

I have a form with multiple fields. I have created a command button which launches excel when pressed.

I wish to export specific fields from access to excel when this command button is pressed. In addition, specific fields from access is to be exported to specific fields in excel.

When I press this command button, it opens excel, and thats all.

Here is the code so far:

Private Sub excel_Click()
On Error GoTo Err_excel_Click
Dim oApp As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True

'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit Sub
MsgBox Err.Description
Resume Exit_excel_Click

End Sub

I am not the best programmar, any help will be wonderful.

Many thanks in advance,


View Replies View Related

Access Find/Search - Version: 2000 (9.0)

I hope this is the correct place to post this so I appologise if it is not.

I have been presented with the following problem and am hoping someone can help me with some suggestions on how to attack this issue.

I have a file on a network drive which over the course of a day gets populated with .zip files. Within each .zip files are scanned documents each with their own unique identifier number. The problem I am having today is that I would like to make a program, maybe within an access form that I can type in a number that will connect to this folder and search through each .zip file for the number that I entered. I have been having an issue with people after uploading the .zip files to this folder, they would come to me and ask me to retrieve a file within one of the .zip's. I have to go through all of them to find the file they would like, which as you can imagine is very annoying. I am hoping that if i can get this program to work that if it finds the ID number within one of the zip's, the program will come back and tell me which .zip it is located it.

Hopefully there is some code out there that I can look over, I am not looking for something that will do exactly what I am looking for, but maybe some tips or thoughts that you all have.

Thanks a ton!!!

View Replies View Related

Access Forms-command Button - Version: 2003 (11.0)


I'am trying to create a form in access which is basically like a quick search page. I have many tables(product tables) with similar descriptions. The main common field being product code. Right now i have created forms for all these tables which search the product based on product code and this works perfectly fine. The problem i have is with the quick search page - where i just want a text field that accepts the product code and a button when clicked searches all the tables and checks if there is a match and maybe i could add labels to this form where it would say 'Found on table A' or 'Not found on table B' etc. I just dont know how i could search multiple tables with one button click. I tried adding a command button but had one button for each table instead i would like if it was a single button.

Please help me with this problem. Thanks in advance!

View Replies View Related

Exit Access Via A Command Button - Version: 2002 (10.0) XP


i am looking for a little help. i have created a command button on the form to exit access completly, however, i would like a box to come up say 'Are you sure you want to quit'. im sure not how to go about this and enable the buttons 'ok' and 'cancel' so that 'ok' exits the application and 'cancel' keeps the user in the application. this is similar to office when you exit without prior saving it.

any help or guidance would be most appreciated.

Many thanks


View Replies View Related

Access Command Button Error - Version: 2002 (10.0) XP

Strange problem just started for me in Acceess. I am guedssing I accidently changed a setting somewhere, but I can't find it. Whenever I try to use the 'command button' tool it just created a command button# icon, but with no event and no options to select what I want it to do. Help?

View Replies View Related

Linking Crystal Report (v10) To Command Button In Access 2003

I am creating a project where I have a form in which parameters are entered. I would like to click a command button to run a query based on the parameters which open the data in a Crystal Report. I was going to use the Crystal ActiveX Report Viewer Control, but I could not find a place to identify the path. The second issue is how to get the parameters to work being selected on the Access side and executed through the query creating a crystal report. The confusing part to me is that there are at least 50 different parameters that could be used/queries that result. I would like to write one report to be used and the report contents determined by parameters/query results. The end result is an income statement if that helps at all. I appreciate any help anyone can provide.

View Replies View Related

Is There An Access Function Analogous To The Search Or Find Exce - Version: 2000 (9.0)

Is there an Access Function Analogous to the Search or Find Excel Functions?

View Replies View Related

Opening A Password Protected Excel File From A Command Button In Access

Hi All,
I have three excel files (ActualHires.xls, ActualPromotions.xls and
ActualSeparation.xls). These are password protected files (with the
same password). They are linked to an access database and whenever the
files are opened, one must supply the password and click the 'Enable
automatic refresh button.' What I was wondering was if this could be
done in access with a command button. I have pasted some code below
that I found but now I'm getting an error.
This is the code:

Dim BookNames As Variant
Dim B As Long

BookNames = Array("O:ExcelFilesActualHires.xls",

For B = LBound(BookNames) To UBound(BookNames)
WorkBooks.Open FileName:=BookNames(B), _
UpdateLinks:=3, Password:="*******"
WorkBooks(B).Close SaveChanges:=False
Next B

But when I click the button, I get this error:
Run-time error '9' Subscript out of range.

and this line is highlighted:
WorkBooks(B).Close SaveChanges:=False

Any help would be greatly appreciated.


View Replies View Related

Clicking A Command Button In An Access Form Using A Macro? - Version: 2003 (11.0)

Hi folks,
I am working on an automation project for which I need to click the 'command button' on a form from a macro. I tried using the SetValue option in the macro(after opening the form first) but havent been able to get it to work. Could someone tell me how to achieve this functionality....Your help highly appreciated!

View Replies View Related

Search Button In Data Access Page

does anyone know how to make a search button in a Data Access Page. I went to the Microsoft Help stuff which wasn't that helpful and changed what i thought was there file names to table i'm using is called CallLog and the data access page is also called call log....can someone give my guidence please.....Thanks

View Replies View Related

Data Access Page Search Button - Version: 2003 (11.0)

Hi Everyone,

I'm trying to put a search button on a data access page that can be used to search for records in any one of 6 different fields of my Access table.
Does anyone know how this can be done by a coding dunce such as myself?
Any help or sample code would be greatly appreciated, I'm going a bit insane here.....


View Replies View Related

Difference Between A Command Button And A 'label' Button

Hi, I have got a small problem and maybe someone could advise me.
I am creating a customised command button from a label button. The new button works fine but I can't apply the 'requery' function to it, if i do an error occures and i am being prompt to save the data first???? :confused: :

Private Sub Labelsearch_Click()
End Sub

Private Sub Labelsearch_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Labelsearch.SpecialEffect = 2
Me.Labelsearch.BackColor = 255
Me.Labelsearch.ForeColor = 10092543
Me.Labelsearch.FontItalic = True
Me.Labelsearch.FontBold = True
End Sub

Private Sub Labelsearch_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Labelsearch.ForeColor = 255
Me.Labelsearch.FontItalic = False
Me.Labelsearch.FontBold = True
End Sub

Private Sub Labelsearch_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Come back to initial state when button release'
Me.Labelsearch.SpecialEffect = 1
Me.Labelsearch.BackColor = 16373685
Me.Labelsearch.ForeColor = 8388608
Me.Labelsearch.FontItalic = False
Me.Labelsearch.FontBold = True

If I create a command button with the wizard and assign the code :
me!itemquery.Requeryto the on_click event my form is working fine.
Why is his code is not working if I assign it to a label? :o

View Replies View Related

Event Procedure For A Command Button On An Access Form - Version: Any Version

I have an access form to input the data and so my table will get updated automatically. I have a command button pasted at the bottom of my Form Design. When I click the command button I want the form to be printed. How do I write a event procedure to activate the command button to print on one click. My form name is SMAC.

Thank you very much for your help

View Replies View Related

Using One Search Button To Search 4 Tables In A Database?

I have a database that uses four forms and each form has it's own table and each form has it's own search button to find a specific record within that table. I would like to use one search button that will look at all four tables and bring up the correct record when the request number is entered. Can I link all the tables to perform this or is code required? Can someone send me in the right direction for how to do this? Give me an example of code if it's required?
Thanks for any help I can get.

Laura Edmark

View Replies View Related

Find Command

I have a find command button that appears to call the find and replace message box. It should be a search for anything in my query. The code behind the button looks like the find and replace message box in the office suite. I believe I am trying to create a message box where you add an entry and it searches then lauches a subform with my entries.

When I checked the button it had the following code:
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit Sub

MsgBox Err.Description
Resume Exit_cmdFind_Click

End Sub

I read a few of the lookup queries but they only give me a drop down. Is there some way to customize the box comes up without altering all of Office or do I just sound lost.

View Replies View Related

Search Button To Search Subform


I have a main form with a search command button in the header. This search facility looks for information in a subform. At the moment I can't seem to get it to work.

Main form called Building
Subform called LineTypeSub
Field its trying to search is called Line

Here's the code I have at the moment.

Private Sub cmdSearchLine_Click()

DoCmd.GoToControl ("Line")
DoCmd.FindRecord Me!SearchLine

SearchLine = Line.Text
strSearch = SearchLine.Text
End Sub

If anyone could help that would be great, thanks.

View Replies View Related

Find Command Question & Couple Other Questions.

Hello All, I was wondering when you use a find command, if you can make it so it searches two tables from the form your currently viewing, not just the data from the table that is tied to that current form.

Second question is I am thinking about maybe taking some "1 day" classes on access. My question is how many people have taken these & are they worth the money, or is it easier just to buy a book & if buying a book is better what is a good access book to buy.

View Replies View Related

Edit - Find Command Defaults - Version: 2002 (10.0) XP


I have a database that allows the user to search records on a continuous form. I added a button to the form that executes the standard Find command. Some of the users also use <Ctrl><F>. They've been asking if I can default some of the items on the Find command, such as the "Match Case" and "Match" (whole field, any part of field, etc.).

I haven't come across a way to do this, and I'm sure there is one. Any thoughts?


View Replies View Related

Find Button

I am trying to add a find button to my form is there any way that I can restrict the find button to only look into a particular column and match any part of the value? The default buttons is not giving me this option how can I change it?

View Replies View Related

Search Or Find?

i have a table with the following fields.

How can i do a search for a particular vessel when every customer will have two of them?


View Replies View Related

Command Button To Set Value

I have been working on this for awhile, and can't figure it out for the life of me!

I have a form set up with a drop down box that lets me pick from values from a table based off of the Primary Key of that table (Row Source = SELECT Order.OrderID, Order.OrderName from Order). I have a button on the form that I want to set a value (Closed) from the table entry based off of the order selected.

Pseudo code would go something like this.

Closed.Value = True Where Table.Order.OrderID = SelectedOrderID

Table.Order is a Table Named Order (obviously)
Closed is a yes/no field in my Order table
OrderID is the primarykey of the table Order
SelectedOrderID is the drop down box.

Any help would be greatly appreciated!

View Replies View Related

Command Button?

I, unfortunately, have been singled out as the Access guru in my work area. We have 223 people and the Information Manager has tasked me to modify a database he "found" to be able to track a number of things, but most important to him: performance reports.

I have posted the sample of what I currently have. What is being asked of me is a way in which to have a button or by double-clicking a block where a date would go for all other dates on the form to become non-visible while the current date stored in the computer the database is being worked from be entered in the block where the button or double-click happened. All this links to a report for the IM to be able to track what performace reports are out, and when they are due back to his section. He also wants me to be able to show which are overdue and where they are at. I am not sure if it is at all possible, but with me having spend most of last week purusing the articles on Access here, I know now that nothing is implausible if you happen to go about it the right way.

Since I have read the rules on posting, here is what I have done. I searched the forum for command button and got a lot of really cool ideas to use elsewhere in the database. I looked up the help in the program itself for command button, and got some good information on how a command button works, but I cannot make it put a date into a block. I can enter the date in any block that is a date format, but then I have dates in every block. He only wants to see the most current date in any of the blocks.

Any assistance at this point would be appreciated. If I have missed something in another thread, I apologise in advance.

View Replies View Related

Command Button %

how can i assign a formula to a command button?

also can anyone give me specific advice about calucalating the % of check boxes ticked across multiple records.

thanks in advance

View Replies View Related

Command Button

A couple of weeks ago I asked the question of how to send a single record from one table to another (Archive table) using a command button. I got a response. I have had time to work with this a little. My problem is I keep getting a error message "Run-time error '3075'; Syntax error (missing operator) in Query expression "[New ID]='. I wanted to mention that the archive table has an "archive ID" field as well as "New ID" that links the tables. I have the following code. Please help with this if possible.

" Private Sub Command667_Click()
' Save the main record if it has not been saved.
If Me.Dirty Then
DoCmd.RunCommand acCmdSave
End If

If MsgBox("Do you want to archive this record?", vbYesNo) = vbYes Then
Dim SQL As String

' Move main record to Grants Activity Archive.
SQL = "Insert into [Grants Activity Archive]" & _
" select * from [Grants] where [New ID]=" '" & Me.ID & "'"
CurrentDb.Execute SQL
End If

End Sub "

The error seems to refer to the & Me.ID section. I have tried putting Me.New ID and also Me.Archive ID. The Grants Activity Archives is the subform where I want the record to go. This subform is set up like a form with many fields so it is a lot of work to type the main record from the Grants table to the Grants Activity Archive table every time you want to archive a record. I hope that makes sense.

View Replies View Related

How Can I Use One Command Button Only?

Hi all

Can any one correct my attached program to make it works with one command button only please?

Using two buttons make conflict.

Any help will be highly appreciated.

Thank you


View Replies View Related

Command Button

Hi I can't seem to be able to find any option to open a table from the command button wizard how is this possible. Thanks

View Replies View Related

Copyrights 2005-15, All rights reserved