How To Call Form Values In A SQL Query
May 14, 2007
Hi,
I need to build a query where upon form input a different table gets queried.
SELECT *
FROM ((Forms!DCL!PortDropDown))
WHERE ((Forms!DCL!DestinationList=(Reg_Dest.Destination) ));
The "FROM" is my problem. The "WHERE" is working. I am getting a "SYNTAX ERROR IN JOIN OPERATION" error message. Please help.
Thank you:confused:
View Replies
ADVERTISEMENT
Mar 14, 2013
I want to track which user has which phone and track issues with them.
I have all the relationships set up right.
I have tables:
DeviceStatus - for the drop down box, contains IT Stock, Faulty, With User and Retired
DeviceTypes - Contains model numbers for devices
Assets - Contains a link to DeviceTypes, a link to DeviceStatus and the serial number of a phone.
I have a query:
StockStatus - shows Assets.ID, DeviceStatus.Status, DeviceTypes.description and Assets.SerialNumber
What I want as an end result is a form with a drop down box that shows DeviceStatus.Status (which I have working at the moment) with a go button next to it which will call the query that only shows what was selected in that drop down box.
View 5 Replies
View Related
Oct 26, 2004
Hi! I have a query setup that feeds off of three combo boxes on a form. It is setup to allow a user to search and calculate revenue for a selected time period by company, then department, then page. If all three or just company are selected, there are no issues running the data. However, if only company and department is selected I receive an 'ODBC--Call Failed' message. The issues seems to be stemming from the department field as I can link the department table to the main table and the query will run without error. The problem with that bandaid is that the query takes more than 15 minutes to run that way as opposed to about 2 minutes to pull more data at the company level.
Any suggestions on why this is happening or a fix that can be put in place? Any help is greatly appreciated.
I can provide more details if needed. Thanks!
View 6 Replies
View Related
Aug 7, 2013
When running a query in Access 2013 or 2010 we get an ODBC call failed. However when we run just the form, which the query connects to, it works just fine.
View 3 Replies
View Related
Sep 4, 2013
I'm having to recode some old MS Access DBs so they will run in the following environments:
Office 2000 on WinXP
Office 2003 on WinXP
Office 2010 on WinXP
Office 2000 on Win7
Office 2003 on Win7
Office 2010 on Win7
When I wrote my code for Office 2000 on WinXP things were simple because directory paths were the same across all computers and I could hard code pathing when using a shell command to launch other files.
My new approach is to make a function call to the Windows registry to determine the default executable and path for opening a file based upon its extension (see apicFindExecutable in basWindows API module).
I'm able to use code to create a shell call and debug print it to the immediate window. If I put my cursor in the immediate window at the end of the shell call and hit [enter] the external file will open as desired. If I try to open the external file directly through code, I get a file not found error.
To recreate the error take the following steps:
(1) browse to files that are accessible from your computer
(2) click the PREPARE DATA AND OPEN MAIL MERGE DOCUMENTS command button
Shell function call is made by the fnOpenFile function located in the basOpenFile module. There has to be a trick here that I'm missing.
View 5 Replies
View Related
Aug 30, 2006
Hi,
Is it possible to call a procedure that exists in one form on another form please?
Regards,
B
View 13 Replies
View Related
Feb 22, 2005
What code would i use to say:
on click
goto the form "datalookup" (which is already open)
and run command "cmdupdate_click" (which is a private sub on that form).
do i have to change it to a public sub? or can i just run it? what code would i use?
View 1 Replies
View Related
Feb 6, 2006
Hello everyone!I need to call the button_click procedure for a button on a form (button1), from another form, if you see what I mean!.Basically the user opens form1. They click a button which opens form2. Once they have finished on form2 they press the close button, which is the point where I need to call the button1_click procedure on form1.I imagine it's something like this:Call Forms![frmForm1]![button1]![Click] orCall Forms.[frmForm1].[button1_Click()]But no matter what syntax I try it just won't work! They're very basic forms, with only 2 buttons on and basic commands.Any help appreciated! Thanks
View 5 Replies
View Related
Aug 8, 2006
Is it possible to call a function from a field on a form, ie, in the
control source put = FunctionName(abc)? Then I want to concantenate
it to another variable so it would look like:
=FunctionName(abc) & TextVariable
I tried this and got the ?Name on the form, like it couldn't find the field
name, which is really a function I'm calling.
Is this possible and if so, what am I doing wrong?
Thanks in advance for any help.
View 1 Replies
View Related
Jul 29, 2005
i have a sample function
Function GetPercent(n As Integer) As Integer
Select Case n
Case 1: GetPercent = 100
Case 2: GetPercent = 50
Case 3: GetPercent = 0
End Select
End Function
I have a table like this
a | b | c | d | e | f | percent
----------------------------------------
1 | 2 | 1 | 3 | 3 | 1
3 | 1 | 3 | 2 | 1 | 3
1 | 2 | 1 | 1 | 2 | 1
2 | 2 | 3 | 3 | 1 | 2
1 | 1 | 1 | 2 | 2 | 3
1 = 100
2 = 50
3 = 0
for example the first row
1 | 2 | 1 | 3 | 3 | 1
(100+50+100+0+0+100) / 6
I think if I can call function from query than I write like it:
strSQL = "update table set percent = " & GetPercent(a) + GetPercent(b)
CurrentDb.Execute (strSQL)
but sure that I got an error because its not find the a and b
how can I do it?
good day!
View 1 Replies
View Related
Jan 27, 2005
I'm making a customer survey database. Also be aware I'm not proficient with access.
All the customer information is being imported from an excel spreadsheet. That will include ServiceRecordID, ServiceDate, TechID, CustName, ServLocation, PhoneNum, and DeptID.
Another table will include records for answers to 5 questions that will be asked by a manager on the phone. That table is called TblQuestions. This table will also have ServiceRecordID to go with the answers.
What I'm trying to do is create a Form that at the top has a box for ServiceRecordID. I'd like to be able to type in the Number for that ID, and then all the information shows up on the form for that specific ID. And below all that, fields to add the answers to TblQuestions for that specific ServiceRecordID.
The reason I'm doing this is because the manager will get a report with the customer information that needs a follow up call. So I want them to be able to call up that information on the screen with the ServiceRecordID number, and also be able to add in the information that they get back from the customer with the questions that will be asked.
I don't know why I'm having so much trouble with this. But I'm not experienced with access or VBA both.
View 2 Replies
View Related
May 10, 2006
I have a sub form which has the Save Button. In case the user keys in the details in the sub form, but then directly clicks the Payment command button of the main form, I want to call the Save button in the sub form if the form is dirty, and do the save, otherwise, proceed with the payment command button.
Every time I try to call the save procedure from the main form's Payment button, I get this error that "object does not support this property or method"
I am calling the save button's code in the subform as
forms.MainForm.SubForm.Save Producedure
Exact Code is : Forms.newpatients.InvoiceHeader.Command7_Click
How do I call this command7_click, which resides in the sub form, in the main form, and invoke it only if the data in the sub form has changed.
Please help.
Thanks,
Vinai
View 1 Replies
View Related
Dec 28, 2004
Hi, it's me again. I hope everyone's holiday season is just fantastic!
I need to figure this out and I don't know quite how to explain it. In a form, I have five fields named "Primary Objectives 1" , 2, 3, 4, and 5. Each is numbered consectively. I am trying to figure out how I can add another "Primary Objective" field to the form, if I need it, without adding the field to my parent table. Is this clear? Is it possible??? Thank you!
View 4 Replies
View Related
Jan 16, 2007
With the script in the form that is part of MS-Access. I wonder how do I access/call the written function that are in the DLL file I made. I appreciate your help on this one...
View 2 Replies
View Related
Nov 4, 2014
I have three forms - Form1,Form2 and Form3 linked to a navigation form with Navigation buttons. I have separate VBA codes under each Before update event of these forms, Form1,Form2 and Form3 to call a VBA module to track the changes performed by the users(Like an Audit Trail) in specified fields of the forms which will track them to a table.there are control tags in the form properties --> others --> Tag to track the changes in the fields which are defined in the VBA Module.this is the code to call the VBA Module:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Call AuditChanges("UniqueID", "Part No", "NEW")
Else
Call AuditChanges("UniqueID", "Part No", "EDIT")
End If
End Sub
[code]....
The code is working perfect when the forms are run separately.but when they are run from the navigation form by clicking the navigation buttons, the code is not working !!
View 2 Replies
View Related
Jun 26, 2013
I was wondering if you can call a textboxes onExit event from another form? On my form a user enters a search criteria into a text box and when they exit the textbox the results are displayed in a listbox. This form is a subform on my main form. I want to be able to call this onExit method from the main form. Is that possible? When I put in txtSearchBox_Exit, I got an error saying Sub or Function not defined.
View 5 Replies
View Related
May 12, 2005
I have a query that uses an odbc table.
The query prompt for a date: [Enter Date]
After entering the date, I get error: "ODBC Call Failed"
Yet...when I set the criteria to the date I want: #01/01/2005# I can retrieve the data, no problem.
Any idea why I get the ODBC Call Faile error when prompting for the date?
Thanks....
BJS :confused:
View 1 Replies
View Related
Jul 4, 2013
I am trying to run a query in Access 2010 but I am getting an "Invalid Procedure Call" error. I searched online and found that this error can be caused by broken references.
I opened the VB editor (Alt F11) to search for "Missing" references but I do not see any. These are the 4 that are checked.
1. Visual Basic for Applications
2. Microsoft Access 14.0 Object Library
3. OLE Automation
4. Microsoft Office 14.0 Access database engine Object Library
View 8 Replies
View Related
Sep 28, 2005
Hello:
Is it possible to call a form event (actually a control's event within the form) from another form?
Thanks in advance.
View 6 Replies
View Related
Aug 3, 2006
I have a table of records, each of which has a date.
I want to create a form which has two boxes on it for the user to input 2 dates and then get Access to query the table of records and display only those which fall between the two dates specified.
I could do set this up using a parameter query but am not sure how to make the query pick the dates up from the form.
How can I do this?
Gary
View 14 Replies
View Related
Sep 28, 2007
Morning all,
Am trying to create a really simple form where the user can select one of five fields, an operator (just =, Not, <, and >) and the values are pulled from whatever field is chosen.
I have the form down and can populate the values list based on the field however now i need to use the values in these boxes to create a WHERE clause.
I'm really new to SQL and have only done a couple of online tutorials but i think im on the right lines?
DoCmd.RunSQL "SELECT * FROM qryLinkMasterPrimary WHERE " + cboFields.Value + " " + cboOperator.Value + " " + cboValues.Value
Is this even slightly close? I've tried searching the internet and everything i find is waaaaay too complicated for me to get my head round.
Any help is greatly appreciated
Mike Harkess
View 14 Replies
View Related
May 2, 2013
I have a form - RunQuery And I have a query - Q2.
The form has text boxes for dates txtStart2, txtEnd2.
On button click I have a macro.
Query Name Q2
view Datasheet
datamode edit
The query will open
The query has a field Assigned which is Date/Time
In my query design view I have this as the criteria:
>[Forms]![RunQuery]![txtStart2] Or <[Forms]![RunQuery]![txtEnd2]
I also have filter on load set to yes.
However the filter does not seem to work.what is missing or wrong?
View 6 Replies
View Related
May 15, 2005
i am trying to create an append query that gets 2 values from one table and a 3rd value from a form.
It gets the values from the table fine but always gives me a popup asking for the value from the form.
I have used the criteria build... and selected the loaded form and the field value that I am looking for. I have also made sure that there is a value in the field on the form.
is there a reason why the query will not grab the number in the forms field? or am I jsut not doing this right.
I have done this many times on a combo box and it works fine. It is jsut not working for a field that is typed in
Can anyone help me?
View 5 Replies
View Related
Nov 12, 2005
Hi,
I have a popup form called Labor that is working perfectly fine, what i mean is that it is getting populated with data from the query I built using a single table called PrimaryBid_Master. However I have had to add many fields to this table before invoking a query on it, now I'm running close to the 255 field max limitation.
So I have created a new table called Labor_Primary with all the fields that I need and took them out of the PrimaryBid_Master table freeing up about 50 fields.
The query I made combines 2 tables: table1=PrimaryBid_Master table2=Labor_Primary, they are linked by a common field called invoice#.
But now when I’m in the PrimaryBid_Master form and click the command button to go to the popup form Labor non of the values that were populating the popup form from the primaryBid_Master form work, they were working fine the only thing I changed was the popup forms record source to the new query I built.
Here is a print screen of the new query I built using 2 tables, and I also show the old query that works fine using 1 table. http://www.roofmart.net/query1.asp
Maybe you can see some thing I did wrong; do I need some type of filter to fetch the fields? When I open the new query there is no data/values in it.
Thanks--I appreciate any help.
View 1 Replies
View Related
Mar 21, 2006
I have a form with 4 different search fields used to query a table and limit results: Policy#, SSN, Credit_Amt, Debit_Amt. Any matching rows based on the search criteria are returned in a subform.
My problem is how to handle any fields where the user doesn't specify a search value.
In my query, I have the Criteria set to:
Field: Policy_No
Criteria: =[Forms]![form name]![Policy#]
Field: SSN
Criteria: =[Forms]![form name]![SSN]
and so on....
If I place my criteria on different OR lines, the query runs, but if a user specifies more than 1 criteria, I get all the data for one criteria(such as policy# matches) and all the data for the second criteria(such as all the records for a certain credit_amt, regardless of Policy #).
If I place my criteria on the same criteria line, effectively making it AND, I get no results because I assume the database is looking for any blank search field values.
So, how do I make the query an "AND" query, but actually get results by ignoring any NULL search fields? So if a user enters a Policy# and Credit_Amt, the results will be only matching rows by Policy# AND Credit_Amt, and doesn't look at SSN and Debit_Amt.
I've tried different iterations using IIF(Not IsNull(.... to no avail.
Thanks!
View 3 Replies
View Related
Mar 13, 2007
Hi i am having problem creating a query that will pull the price of a property into the price field on to a booking order form depending on the values of the start date and property number enter onto the same form.
i have a two tables property price and booking order.
Fields in the property price are property price no, property no, start date, end date and price.
Fields in the booking order table are booking no, property no, start date, end date, cost, no of days, total cost.
When in the booking order form i need the query to get the price from the property price table matching on the property no i've selected on the booking order form and also the start date i've entered on the booking order form needs to be between the start and end date fields in the property price table.
This is the query i have created but doesn't work
SELECT [Property Price].Price
FROM [booking order] INNER JOIN [Property Price] ON [booking order].[Property No] = [Property Price].[Property No]
WHERE ((([forms]![booking order subform]![start date]) Between [property price].[start date] And [property price].[end date]) AND (([Property Price].[Property No])=[forms]![booking order subform]![property no]));
Thanks for your help
View 2 Replies
View Related