Is there a workaround? Answer: Single quotes can sometimes cause problems when writing queries in VBA as this example does. To workaround the error that you are receiving, try stripping out the single quotes when performing the search. This code strips out the single quotes for the purposes of searching, but still displays the search results with the single quotes intact.
While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy. Home MS Access Forms. Please re-enable javascript in your browser settings. Please see below. After the user gets the search list, I want the user to be able to access a particular record by just clicking such record.
In addition, I want that the user can click any field of such record to access it to make it more user-friendly, it is not a necessity though. Therefore, we need to put an event procedure to each field of the subreport.
Put in the below VB codes for such event. ID DoCmd. The record is identified by the ID field of such record. Repeat the process for other fields in the subreport. For example, put in the below VB codes for the second field First Name. When it is all done, it will look like below. Please note that all data are faked. Now 4 records show up and the user can click any field of a particular record and edit the data of such record with all the fields.
Below is the VB Codes. After you create the first search form, you can use it as a template for another search form. Please keep the subform as it is. You only need to change the input text box. For example, you can create another search form by searching the Account Number.
The VB code will be as follow.. Once you have created the button place this code in the "OnClick" event of the button. You are going to have to put the appropreate names in the corrisponding places Expand Select Wrap Line Numbers. How do I create a bound text box. I created a new text box on a form and it says unbound.
To create a bound text box you are going to need to Right Click on the text box 2. Select Properties 3. Click on the Data tab 4. There should be a drop down with selections of the feilds in your table if your form is bound to a table To bind a form to a table 1.
In the properties menu for the Form do to the data tab 2. Click the drop down box and select the table you would like the form bound to. If im not explaing things good enough here are a couple sites you can take a look at there are very good and provide a lot of detailed information about how to do things in Access Search Form How To Articles More How To's.
I created a form and dragged the fields I wanted to the form. I create the command button and also pasted what you gave me on clickevent. I get errors when I click the button. Did you name the button "ButtonsName"? To name the button, In design view I right click on the button and then select the all tabe. There is a field there called name in the field I inputed "ButtonsName". Is that correct? Yes, but you can name the button whatever you'd like.
Just make sure that whatever you name it to you change it in the code, because if you don't then Access doens't know where to look when you press the button. Can you highlight for me what areas in this code i need to edit I may have edited it incorrectly. Expand Select Wrap Line Numbers.
No it didnt unfourtunately would you mind if I emailed my db to you? Or if there is a way for me to post it here or tranfer to you via IM. Jim Doherty Expert MB. Ali, I have this afternoon created an AC database for you that deals specifically with your introduced question. It is a flexible method of searching across any number of fields in combination with each other. If you use your imagination with the demo sample you will quickly realise that it can be adapted for many areas.
The sample assumes you are familar with VBA code and you eventually will be I have only just joined this forum this afternoon and cannot see an upload button? Sure PM me and i'll give you my e-mail address.
0コメント