Topics Search

Search Records VBA?

Search Records VBA?
Views: 102
I have a dbase I am working on that I want to be able to search all records and pull of those with matching fields.
I.E. a name, or catageory or number.

Orignally I used a microsoft template and changed what I needed but I decided to do it from the ground up to make it cleaner. Now that I have got to the search forms/tables I can not get it to work.

The question is can I do a search from a form, without using VB since I know not a thing about it.
Sponsored Links:

Similar posts...

 

VBA table population

VBA table population Icon
This is my first post and I am relatively new to VBA but not to programming in general.I have a small table that I successfully created a small search function for and now I am trying to find a way to add records to the table.

As of right now I have a main form with 2 buttons, one for the search and one for the add. The form for the add is finished except for the VBA in the back end. The fields in the add form correspond to the fields in the table but I can't figure out how to go about getting new records into the table.

Is it an SQL INSERT statement? Or is there a built in function in VBA thatwill allow me to do this?
 

Mailing Labels from a Search Form

Mailing Labels from a Search Form Icon
I have a Search form (frmSearch) based on the method of Allen Browne ([LINK]) which I highly recommend as it creates queries on the fly. It is based on a query (qrySearch). I can easily export the results to Excel with a short VBA code I found (Send to Excel).

What I need is to create labels from these results. I have created a report to generate labels using the Access 2007 Label wizard. This report is also based on the same query as the Search Form.

I thought that if I obtain my search results I could simply send these to the label Report using a macro ("Open Report"). Unfortunately all I get is ALL RECORDS RETURNED, not the searchform subset of records in front of me.

I am unable to base the labels Report on the Search Form. Can this be done with a Macro or is it strictly VBA? If VBA, is there an example I can follow?
 

Search on Subform

Search on Subform Icon
I have a subform on a form. I know that there is a certain word in a field on the subform, but when I try to use the in-built search feature to search for it, I get an error.

It seems that the search on the subform only searches in the child records related to the current parent record.

Does anyone know how I can seearch in ALL records of ALL the parent records (if that makes sense
 

Using IIF & Like statements in query

Using IIF & Like statements in query Icon
Normally I would do this in VBA, but I'm intrigued as to whether I can do it in a query.

I'm building an advanced search for my DB and the user can select many option:

1) What field to search in
2) Whether to search the entire field, or Any part of the field
3) Whether to search all records, or just 'Live' Records.

To do this I'm trying to use the iif statement. But can't get the LIKE operator to work inside the iif.

eg:

IIf([srchCriteria1]=1,Like '*' & [name] & '*',[name])

This works fine if srchCriteria1 isn't '1' and the full name is found. But can't get it to search any part of field
 

Access Search box via VBA

Access Search box via VBA Icon
I successfully created a form and a search box within Access using a VBA code. I am tasked with performing another search but now each unique identifier has multiple data associated with them that I need identified in my search form. Does anyone know how I can update the code to show these changes
 

Search a Subform

Search a Subform Icon
I want to search a subform, of course the search only looks at the current form not all the records ever entered .
So I have in the subform a search btn
...
Closes the form (and Sub) and opens the sub on its own with all the records search works, I then have an exit btn under the search btn which is now visible False...
 

Text Box search of Form with a Combo as Part of Form search

Text Box search of Form with a Combo as Part of Form search Icon
I have started creating a database with a bound form. What I want to know is how to use either one of the records for a search for the related records associated with it or a separate text box to initiate the search. at the same time I want to replace say two of the fields text boxes with a combo box that will retrieve any and all records for the associated fields related to the search field, which will be two columns of data drop data.
 

Deleting Records using VBA Module

Deleting Records using VBA Module Icon
What is the recommended method for deleting records using a VBA module? Currently I am using an SQL method that specifies the table name and the upper time stamp date from which values should be deleted.

My database is continually being updated with new files from this same VBA module. I would like to delete old records based on a rolling window (say 30 days). Would this be the best way to go? It seems a bit slow.but then again my database contains 1 million + records.
 

VBA Set default value

VBA Set default value Icon
I have recently created a filter on a form which allows me to search records using a option group that then filters a combobox, as I have 5 different types of properties to search between,and I've got that part working fine.

However when I first open the form I would like the combobox filtered with the records for "type 1" (set as default within the option group) but the combobox displays ALL records - once I click into the other options the filter works fine.

[CODE]

but it's my first real crack at coding and I'm pretty happy with it .
 

Exporting Search Results to Excel

Exporting Search Results to Excel Icon
Recently, I've been working on developing a comprehensive search form for my staff to use when searching for records on our database. I found an excellent VBA code example on the forum a few days back (Thanks again gromit!) and I'm trying to get the results of said search exported to an Excel spreadsheet when the user clicks the "Export" button.

I use a Private Function called "BuildFilter" that runs and evaluates all criteria entered when the "Search" button is clicked, but is there a way to call the search results into an OutputTo method?

The form I'm using displays the results in a subform based on a query with no criteria (as it is filled by the user) but currently the OutputTo method exports all records since the command is only calling the original blank query.

I'm hoping to call the BuildFilter's results, then transfer the data to Excel.