Search Records VBA?
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.
Thank you for taking the time to report an issue.
What's wrong... Please write below.
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?
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?
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
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.
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
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...
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.
but it's my first real crack at coding and I'm pretty happy with it .
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.
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.