Modules & VBA :: Open PDF From Form With Search Parameter
Sep 10, 2014
I have searched for bits of code to copy other people better than I, and had some success but I am failing to complete, so it is now time for me to visit you all. I am trying to open a PDF from a button on a subform. The location of the PDF is specified in a field. I want to open the PDF and search for a Member ID criteria also listed in a field on the Form.This is my code:
Code:
Private Sub Text12_Click()
Dim strPath As String
Dim Searchmem As String
strPath = [Notetxt]
Searchmem = [MemID]
[code]....
Adobe Reader reports "There was an error opening this document. The file cannot be found." but then opens the file (that's something).So it's the "search" bit that is the problem, and I cannot for the life of me get my search parameter to be used.
I have one form which have two multiselect listboxes. They work, but every time when I choose id_organizacija from listbox popup enter parameter value comes up.
I am already tried to put id_organizacija in [ ] but that didnt solve problem.
Code: Set ctl = Me.lstEmployees For Each varItem In ctl.ItemsSelected strWhere = strWhere & ctl.ItemData(varItem) & "," Next varItem Set ctl = Me.lstOrganizacija
I've run into a strange problem. I'm trying to have an image box that you can double click and it will open a different form with a full sized image. When I open my form with the larger image, it asks me for a Parameter Value. Is there any way to stop it from asking me for that? Also, what is a parameter value and should I be typing something there?
Any ideas you may have would really help me out. Thanks a lot in advance!!
I would like to have a button in a form that the end user clicks and they then enter the name of the tif file they are looking for and on pressing enter the file is searched for and if found it is automatically opened up for them to see, if it is not found then a message "File Not Found" is displayed.
I Believe that I will need something like this:
Code:
Dim FS As FileSystemObject Dim filenum As Integer Dim tmp As String Dim Folder As Folder Dim subFolder As Folder Dim File As File
[Code] .....
It's when I get to this point that I've got stuck, I don't know how to structure the code required to do the search and on finding the tif file open it.
An example tif file I might search for is: 0H214_2CJ0001905.tif.
I was tasked to create an application where by the user enters keywords into an Access form, and when he clicks the button, it will run the keywords against the file names stored in the table and automatically open the Word document that is the best match.
I have created a table query called Directory, which contains FPath (Z:), FName (Document1.doc) and Directory (Z:Document1.doc).
Code: Private Sub Command2_Click() Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim filepath As String Dim strSearch As String
If IsNull(Me.txtSearch) Or Me.txtSearch = "" Then MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
[Code] ....
This is the code that I am currently using to search and open the Word documents, however, this code only manages to open Microsoft Word program without loading any documents. Also, there are no error messages when I click the submit button.
I have a database with lists clients across the UK. I have now been asked to provide options where users can select clients grouped by geopraphical area e.g say clients in Scotland.
I can of course do this but having numerous identical forms where the source queries have different parameters depending on the regions required.
The only problem with this is that I would need numerous forms and queries. Additionally, there are options on the form to navigate to linked forms which would all need to be unique.
What I would like to have options on my main (Switchboard Type) Introduction Form to select the region. The code on the relevent command button would include the parameter. I would therefore not require the additional forms.
The open form codes includes:
Dim stDocName As String Dim stLinkCriteria As String
I feel i need something after "frmClients" such as qryClients.ClientArea = "Not Scotland". Various attempts to incorporate something has created errors.
Whenever I open the form 'TrainingF' I get the 'Enter Parameter Value' msg box. I tried to look online but could not get rid of it. I have attached the file.
I am 2 years into my database. I am trying to find and open a folder based on a text box. The problem is folder could be in many sub folders which is hold on our J: drive.
To further complicate, the folder i am searching may not be exactly as the text box states.
EG. Text box could say 123456 however the folder could be called M123456 etc.
How do i locate a folder or subfolder and open it based on part of a text box...
I have a database where I'm allowing a user to update a record in a table using a form.
I want the user to be able to search by name to find therir unique reference number if they don't know it already. I've built a query and based a form on the query so the user gets a personal profile for every 'Smith' come back. They can use the navigation buttons to scroll through all the smith's until they find the one they want.
I want the user then to click on a button which will open up the main form when they find the correct person. I've tried using code like:
Open form where payroll number=forms![name search].[payroll number].current but it's not working.
I have a report based on a query that has data for many dates. At the moment I have put a specific date in the criteria of the query so that I could build the report format. So it now displays all the data for the date i have in the criteria section. I will need to run this report several times per week so the specified date (and corresponding data in the report) will need to be changed to a new date when I open the report i.e. when I open my report I want to show data in the report only for a specified date.
Can I create a date parameter box open up when I open the report? Can I create a form with a button that when I click will open the report displaying data for that date? What would be the best way?I also need to display the specified date on the report.
I need creating a just form that has an unbound textbox and a button for search record. For instance if the user enter the criteria in the textbox and the item matches the criteria in the search textbox. it will open up the form. It's like google website.......
How to open a search form with a mouse click on Button_Search
My idea is to pop up a form where user can enter the search text and select the required name and get back to the old form with all details about the entry. This form alone is workign fine. I want to call it in a mouse click. and pass the data back to old form.
I'm creating an amortization schedule database using Access 2010.
I designed it such that I'll input actual principal and interest amounts in tbl_LoanActivity when I get statements in. I'd like to be able to press a button to update forecasted principal and interest amounts, then later I'll add code to make a report pop-up.
I initially designed this with only one loan to see if I could make the thing work, and it did. I've since added another loan and made adjustments, and this is where I'm having an issue.
tbl_LoanActivity references tbl_Loans, which has interest rates and monthly payment amounts. Needless to say tbl_Loans is the RecordSource for frm_Loans, and as such has a field LoanID. I have two queries that need to reference [Forms]![frm_Loans]![LoanID]:
I can run these 2 queries (individually) with a reference to frm_Loans.LoanID just fine. (Without that reference, forecasted principal and interest numbers are highly inaccurate.) I have a qdf append query (vba) to calculate forecasted principal and interest amounts based on the most recent principal balance (referencing queries above), and relevant data in tbl_Loans (InterestRate, and RecurringAmount).
So here's the problem: without the above queries referencing [Forms]![frm_Loans]![LoanID] the qdf runs, yet produces inaccurate numbers. With the above queries referencing [Forms]![frm_Loans]![LoanID], Access gives me a message "Too few parameters. Expected 1." If I take the qdf and put it into a standard query it runs just fine. I need this append query to be a qdf so it will loop until RecordsAffected = 0.
I've sterilized the data and attached the database. I was thinking this adjustment of adding the reference to [Forms]![frm_Loans]![LoanID] in the 2 above queries would work, but it seems like the qdf is not inheriting the parameter.
I have the below code behind a form so that a combo box will display a specific list of items based on the data in another combo box on my form.
I have two copies of this same form for two different departments. One of the forms works like a dream. However, when I copy that form, change the name, and update the code as pictured below, the form is asking for a parameter FROM MY ORIGINAL FORM and will not requery the combo box. I can't figure out why...there is no reference to the original form in my VBA as you can see below. I tried deleting the form and re-creating it, I tried deleting the code and re-typing it to no avail.
Private Sub cmboType_AfterUpdate() Me.cmboAction.RowSource = "SELECT tblStatusList.Status FROM tblStatusList WHERE (((tblStatusList.Department)=[forms]![frmInquiryFraud]![cmboType]));" End Sub
I have got a serious problem with parameter searches. What I want are multiple field parameter searches in one query. I created a new query, and set the criteria to Like "*" & [...] & "*" for at least 5 fields. The problem now is, that the number of records get less the more parameter searches i create for different fields.
I tried to put the parameters into the "or" criteria but it still does not work!
please give me a hint.
Thank you!
John
PS please ask me when you did not understand my question.
I have got a serious problem with parameter searches. What I want are multiple field parameter searches in one query. I created a new query, and set the criteria to Like "*" & [...] & "*" for at least 5 fields. The problem now is, that the number of records get less the more parameter searches i create for different fields.
I tried to put the parameters into the "or" criteria but it still does not work!
please give me a hint.
Thank you!
John
PS please ask me when you did not understand my question.
I have a table in sql holding telephone data. the starttime column and endtime column are both in "10/05/2006 12:55:56" format.
I want to run a parameter query that lets me search by agent name and then by date. The agent name is no problem but when running parameter query by date it brings back no data. I think this is because the time is also in the same field as the date. Ideally I would like to be able to run the query between certain dates, e.g. find data for agent1 between 2 different dates.
In criteria of a Query I have this SQL: Like [Forms]![FSearch].[qb1] & "*"
This SQL is to write in a textbox one parameter at a time to search in a table.I need to search for more than one parameter at a time and I have been trying to add to the SQL the operator OR or AND but does not work.
Like [Forms]![FSearch].[qb1] & "*" OR Like [Forms]![FSearch].[qb1] & "*" Like [Forms]![FSearch].[qb1] & "*" AND Like [Forms]![FSearch].[qb1] & "*"
How can I search for more than parameters at a time?
I am using the following code to filter my form with a search box:
Code: Me.RecordSource = "qryCompanies" Me.Filter = "CompanyName Like '*" & Me.SearchTxt & "*' Or webpage Like '*" & Me.SearchTxt & "*' Or PriorName Like '*" & Me.SearchTxt & "*'" Me.FilterOn = True
[Code] ....
It works great with one minor issue: if I try to search for a name containing an apostrophe, I get a syntax error. So, it won't find Children's Hospital for example.
In Access 2003 I create a query which for one field was link to a value on a form.
Now I have to duplicate this form and instead to duplicate this query I wanted to use a parameter inside this query for one field and then via VBA call this query and give a value for this parameter.
My query name is: Query_Parameter
Fields inside: "Asset_Name" and "Isin" Parameter is under the "Isin" field: [Look_Isin]
My VBA code is:
Sub Test_Call_ISIN() Dim dbs As DAO.Database Dim qdf As DAO.QueryDef Dim rst As DAO.Recordset Set dbs = CurrentDb 'Get the parameter query
I want a user to enter a number into an input box and then based on the number in this box a form will be opened with records associated only with that employee number. (All employee numbers are stored as text)The code below opens the form, but it is blank.
Private Sub cmdOpenAddKeys_Click() Dim EmployeeNumber As String EmployeeNumber = InputBox("Please Enter Employee Number:") DoCmd.OpenForm "frmAddKeys", acNormal, , "[Forms]![frmAddKeys]![empno]=" & EmployeeNumber End Sub
I have a list box that displays records. When i double click a record it opens the form needed.However I want it to open the form but default to a specific tab. But when it goes to the tab, the subform within it needs to match the ContractID of the record they double clicked on in the search form?I currently have this which opens the Client Form based on the ClientID of the listbox query search results and the client id of the main record.
Code: Private Sub SearchResults_DblClick(Cancel As Integer) If CurrentProject.AllForms("frm_Clients").IsLoaded Then DoCmd.Close acForm, "frm_Clients" End If DoCmd.OpenForm "frm_Clients", acNormal, , "[ClientID] = " & Me.SearchResults.Column(0)
So in theory If doubleClick then open Client Form on Tab3 where subform Contract field ContractID is matches the ContractID in on the search results?
I have attached a (slimmed down) Access 2007 database used for Asset Management and fault reporting. It opens on the main form which has a number of subforms and one sub-subform.
To make the form as user friendly as possible I am placing a number of unbound text boxes on the FormHeader to be used for search queries. The AfterUpdate event for each text box executes the necessary query, searching on the contents of the text box.
This works absolutely fine for the 'Colloquial Name' text box and associated field - this field is in the main table, RTI_Assets. The main form frmRTI_Assets is bound to this table. The query executed is called 'Colloquial Search'.
I cannot however get the 'Fault Reference' search to work on the field Supplier_Reference in the RTI_Fault table (the subform subfrmRTI_Fault is bound to this table). The query executed is called 'Fault Reference Search'.
There are 15 records in the assets table and 2 records in the faults table - with supplier references 555 and 101010.
I get prompted with Enter Parameter Value for the field RTI_Fault.Supplier_Reference if I enter 555 in the text box. Whatever I enter in this prompt I get returned to the first record.
I have a parameter query in which consists of a search statement as below:-
Search: [Model] & " " & [FiscalYear]
It works very well. I am wonder if there is any options available to affect the search results. As far as I understand, when I enter the key word into the pop up box, it will search the fields sequentially and populate the result. Can I enter different key word for each field? If so, what is the syntax for entering the key words.