Showing A String Query Result In A Subform

Sep 19, 2005

I have a dinamic SQL string built by a function, and i want to assign it to a query to show it in a subform.
Here are the names.

Form FrmServiciosAfectados
Subform subFrmcnsServiciosAfectados
Query cnsServiciosAfectados
Built SQL String strSQLPuertosCanales

Please help me with code.

View Replies


ADVERTISEMENT

Modules & VBA :: Result From A Query To Specify String To Use

Jun 7, 2015

I have a query that returns the string to use but I am not sure how I can actually use the returned value to do what I want.

e.g.
my table:
Partner ID Backup Field
5023949 UPC
501354 GTIN

my query will return 1 [backup field] value from the table above, and I then want to use that value to get another value that was previously declared in my code.

eg
GTIN = "ABC123"
UPC = "123ABC"

if my query returns the value "GTIN" then need to use the value of GTIN (ABC123) in my next part of the code.

msgbox GTIN would result in a message box ABC123

But I am not sure how to get the result value. I can say msgbox [backup field] but that returns "GTIN" not "ABC123"

View 14 Replies View Related

Result In Query Not Showing Because Field Not Filled In (Joined Tables)

Apr 23, 2014

I have a query, that I have a criteria to show appointments in the past (< Date()) but one result doesn't show up although the appointment end date is a past date, it only shows up when I fill in a field that is in another table that is joined and part of the query. But there's no criteria there for it to not be null.

View 3 Replies View Related

Print Query Result In Subform

Jun 22, 2005

I wish to print the result from query in a subform. In my main form, I had a textbox call 'year' which asking user to input a valid year. The query will have to find out all the records that are in that particular year, one year before and one year after. After that, it should display the result in datasheet form. Can anyone out there help me in this matter?

My second question is Can we use crosstab query in the subform?

Thank you.

View 1 Replies View Related

Display The Query's Result In Subform

Jun 22, 2005

I wish to print the result from query in a subform. In my main form, I had a textbox call 'year' which asking user to input a valid year. The query will have to find out all the records that are in that particular year, one year before and one year after. After that, it should display the result in datasheet form. Can anyone out there help me in this matter?

My second question is Can we use crosstab query in the subform?

Thank you.

View 2 Replies View Related

Only Showing The Avg Result For Fields-report

Jun 12, 2006

Please help

I have created a database to track student grades. I have made a report that shows the different grades for each criteria of each unit but, because the students get to do the unit many times it shows the same criteria many times on the report. What I want to do is have the report show only the best grade for each criteria.

i also want to be able to work out the average grade for each unit from the best grade for each criteria and store this for use in another table.

If you require more info i would be happy to supply this. Thanks

View 4 Replies View Related

Modules & VBA :: Query Result Doesn't Show In Subform

Aug 22, 2013

I already success to run this dynamic query where the parameters taken from the main form.Now the problem is the query result doesn't show in the subform.But the status bar below tell me that it have 2 records in the subform, but there is no data in the subform, it just Blank.I already apllied the Requery or Refresh to the subform (in the Command Button), but it have no result too.This is the code:

Forms!MsDataWarga.QueryDataWarga.Form.RecordSource = "MyQuery"
Forms!MsDataWarga.QueryDataWarga.Requery
Forms!MsDataWarga.QueryDataWarga.Refresh

View 4 Replies View Related

Forms :: Controls Disappeared After Showing Blank Result

Dec 4, 2014

I have a form with a query assigned to it . it has also some controls to filter the data when i filter the data and there are any relevantr data for the results the form shows nothing for the query and it's true but the controls will be disappeared and i have to go out from the form and come in again to be able to filter the query again.

View 3 Replies View Related

Queries :: Run Saved Query Object In Access Through VBA And Display Result In Subform

Jun 25, 2014

I have saved query object named qrySearchBill. I wan to call this query through vba and display the result in a subform named subQrySearchBills in datasheet view. Here's how I want it to work:

When the main form loads, I want all unfiltered records to be displayed in the subform initially. The user may then decide to filter based on date range, so he enters startdate and enddate parameter values in their respective textboxes in the main form. Then click search button to run the saved query based on the date range parameter taken from the textboxes.

I have this code so far:

SQL of the saved query object:

Code:
PARAMETERS [StartDate] DateTime, [EndDate] DateTime;
SELECT tblInvoice.BillNo, tblCrdCustomer.CstName, tblCrdCustomer.CstAddress, tblCrdCustomer.Island, tblInvoice.Date, Sum(tblInvoice.[TotalPrice]) AS Amount
FROM tblCrdCustomer INNER JOIN tblInvoice ON tblCrdCustomer.IDNo = tblInvoice.NameID
WHERE tblInvoice.Date Between [StartDate] And [EndDate]
GROUP BY tblInvoice.BillNo, tblCrdCustomer.CstName, tblCrdCustomer.CstAddress, tblCrdCustomer.Island, tblInvoice.Date;

vba code to call the query and its parameter:

Private Sub btnSearchBill_Click()
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset

Set qdf = CurrentDb.QueryDefs("qrySearchBills")

[Code] ...

This code works fine except that when the main form loads, a prompt window appears to ask for the value of dateStart and dateEnd. I don't want it to prompt because it's suppose to get these values from the main form's textboxes (txtStartDate and txtEndDate respectively), plus it should initially display all the unfiltered records.

View 3 Replies View Related

Reports :: Open A Report But Only Showing The Result Of One Record In A Sub Form?

Jun 21, 2013

i want to open a report but only showing the result of one record in a sub form,

i have a field that is on all rows of the subform,[click to run] and what i want the user to be able to do is double click on this field and it will open the report with only the record information for that row displayed.

View 1 Replies View Related

First Item Selected Not Showing Up In Text String

Aug 28, 2015

I have an unbound listbox "Needs", and in the onclick event have the following code which works great if I have more than one item selected, but if I only have one item selected, it does not put it in the text box "ServiceText".

Code:
Private Sub Needs_BeforeUpdate(Cancel As Integer)
On Error GoTo errHandler
Dim ctl As Control
Dim strStart As String, strEnd As String
Dim aryList As String
Dim varSelected As Variant

[code]....

View 4 Replies View Related

Queries :: Conditional Query To Post Result In Field And Filter Result Records?

Mar 5, 2014

I am working with Access 2010, on vista. What I have is a query made up of two tables, one product the other inventory. (see below) query.jpg

In the product table i have a field called "minimum reorder level". In the inventory table i have two fields one called "number in stock" and "number on order". What i want to happen is "number on order" to be filtered by the result, if the "number in stock", is less than "minimum reorder level", if it is, have the result placed in the "number on order" field. EG. if the "number in stock" = 2 and the "minimum reorder level" = 5 then 3 would be placed in the field "number on order" and only the second record from the query would be visible (see below) Query result.jpg The result of this would mean that the field "number on order" would be populated with the result and the and query would also use this to filter the record.

View 1 Replies View Related

General :: Adding Count To Result Of Query Depending On Month And Result

Aug 18, 2013

I want to add a number to my results within a query depending on the month and how many results. For example I have 10 results in my query 3 from January, 5 from March and the rest from April. The 3 from January would be 1,2,3. The five in March would be 1,2,3,4,5 and so on. Is it possible to do?

I'm using access 2003.

View 4 Replies View Related

Sum Specific Values On Subform And Place Result On Another Subform

Jan 10, 2015

The forms in the code are subforms on a TabControl on a main form.

I have this code which needs to add together only the areas [Area] of records with a FloorNumber field value of 1 or 2 or 3 or 4.

At the moment the code works for one entry of 1 in the form frmRoomDetails. I'm guessing i need For Next or something like that but i don't know and also unsure of how to code it.

Private Sub FloorNumber_AfterUpdate()
If [Forms]![frmSiteDetails]![frmRoomDetails].[Form]![FloorNumber] = 1 Then
[Forms]![frmSiteDetails]![frmFloorsDetails].[Form]![Text8].Value = [Forms]![frmSiteDetails]![frmRoomDetails].[Form]![Area]
End If
End Sub

View 1 Replies View Related

Queries :: If There Is No Result In Query Need To Have Default Result Zero

Oct 12, 2013

I there is no result in query, I need the default result zero in my form field. I only use query wizard to create queries.

View 5 Replies View Related

Access Search Form And Result In A Subform

Feb 11, 2004

Hi,

I have a problem to make a search form in access, I want to divise my form, at the top will be the search criter (8 fields) and in details section will appear the result. I use a continuous subform with a query on the searched fields.
But I can't actualise or open the subform with the new results.
I would like a button to start my search or a system to automatically show the result on AfterUpdate event.

Can you help me, please? i trying to solve this for a long time...

Thank you,

Mrflo

View 13 Replies View Related

Forms :: Run Subform Queries From ComboBox Result

Sep 10, 2014

I am currently building a main form with a combo box control, two subforms and a hidden text box (optional). There are many different references to be made between tables, queries and forms to get to the result I am after, and I have tried many different codes from other people’s queries that seemed close to mine; however, had no luck getting my subforms to work as I’d like.

The names of my controls/forms/queries are as follows…

Main Form: frm_UReport
Subform 1: sbfrm_Query1 (refers to Query1, which refers to and calculates on tbl_C)
Subform 2: sbfrm_Query2 (refers to Query2, which refers to and calculates on tbl_S)
ComboBox: cmbo_ProductList (refers to tbl_ProductList)
TextBox: txt_ProductCode (refers to cmbo_ProductList, column 0)

I want the two subforms to run their respective queries after a Product Code has been chosen from the ComboBox. The relationship between the tables is one-to-many, from tbl_ProductList to each of tbl_S and tbl_C; with ProductCode as the primary key in tbl_ProductList.

Currently, I can choose a Product Code from the combo box, and it populates the text box successfully, but nothing happens in the subforms.

The codes I have worked with so far are as follows…

sbfrm_Query1 (Record Source):
SELECT Query1.ProductCode, Query1.PurchaseDate, Query1.ExpiryDate…
FROM Query1 WHERE (((Query1.ProductCode)=[Forms]![frm_UReport]![txt_ProductCode]));

sbfrm_Query2 (Record Source):
SELECT [Query2].[ProductCode], [Query2].[ProductDescription], [Query2].[PurchaseDate], [Query2].[AverageCost]…
FROM Query2;

[Code] ....

I have started working on integrating sbfrm_Query1 into the main form first, which is why the code looks different between the two subforms. Once I have it working, I will translate the same format to sbform_Query2.

Due to all the different levels of references that need to be made, I am having trouble identifying which (or if all) of the codes are incorrect.

View 8 Replies View Related

Subform Showing Wrong Records

Sep 12, 2005

I have a form "Training", with a combo box that holds employee names and a subform with all of their training records linked by "EmployeeID". Quite often lately, when the user selects their name from the combo and the code below runs, someone else's records appear in the subform. There doesn't seem to be any kind of pattern, ie. the previous employee on the list or the next, etc.

Private Sub Combo6_AfterUpdate()
' Find the record that matches the control.

Dim Rs As Object

Set Rs = Me.Recordset.Clone
Rs.FindFirst "[EmployeeID] = " & str(Me![Combo6])
Me.Bookmark = Rs.Bookmark

'Forms!Employees![Combined Subform].SetFocus


End Sub

I have the db split with both the FE and BE on the server and a batch file that runs from a link on our intranet. The table that holds all of the data is at 3,195 records and the db is just under 4MB. I compact/repair regularly.

There are 66 users - usually 3-4 concurrently.

Is it time to think about moving the BE to SQL or Oracle?

Thanks for any help you could offer.

Toni

View 5 Replies View Related

SubForm Not Showing Updated Data

Jul 5, 2006

This one is driving me NUTS! I have a form with a combobox, a few textboxes, and a sub-form.
On Load the form is populated with a sql command/rcSet.Fields() results.
The user then chooses a status from the combobox to narrow down the results. The combobox OnChange event looks like this...
sDate = Forms("frm-MENU").txtS_Date.Value
eDate = Forms("frm-MENU").txtE_Date.Value
xJob = Forms("frm-HD/DVR_CC").lstJob.Value

On Error GoTo hd_dvrErr
'this gets the top of the HD/DVR form
sSQL = "SELECT Count(*) AS Total, Sum(IIf([pmt_meth] In ('C','E'),0,1)) AS Error, Sum(IIf([pmt_meth]='C',1,0)) AS [Credit Card], Sum(IIf([pmt_meth]='E',1,0)) AS EFT " & _
"FROM [tbl_HD/DVR_CreditCard(*)] " & _
"WHERE ((([tbl_HD/DVR_CreditCard(*)].CDATE) Between #" & sDate & "# And #" & eDate & "#) AND (([tbl_HD/DVR_CreditCard(*)].JOB_TYPE) Like '" & xJob & "*'));"

Set db = CurrentDb()
Set rcSet = db.OpenRecordset(sSQL)


With Forms("frm-HD/DVR_CC")
.txtTotal.Value = rcSet.Fields(0)
.txtError.Value = rcSet.Fields(1)
.txtCC.Value = rcSet.Fields(2)
.txtEFT.Value = rcSet.Fields(3)
End With

'this gets the bottom or subform of the HD/DVR form
sSQL = "SELECT IIf([Agent]='UNKNOWN','xxxxx',[REP]) AS [Agent ID], [tbl_HD/DVR_CreditCard(*)].Agent, [tbl_HD/DVR_CreditCard(*)].JOB_TYPE, Count(*) AS Total, Sum(IIf([pmt_meth] In ('C','E'),0,1)) AS Error, Sum(IIf([pmt_meth]='C',1,0)) AS [Credit Card], Sum(IIf([pmt_meth]='E',1,0)) AS EFT, Sum(IIf([pmt_meth] In ('C','E'),0,1))/Count(*) AS [Error Rate] " & _
"FROM [tbl_HD/DVR_CreditCard(*)] " & _
"WHERE ((([tbl_HD/DVR_CreditCard(*)].CDATE) Between #" & sDate & "# And #" & eDate & "#)) " & _
"GROUP BY IIf([Agent]='UNKNOWN','xxxxx',[REP]), [tbl_HD/DVR_CreditCard(*)].Agent, [tbl_HD/DVR_CreditCard(*)].JOB_TYPE " & _
"HAVING ((([tbl_HD/DVR_CreditCard(*)].JOB_TYPE) Like '" & xJob & "*')); "

Set qdTemp = db.QueryDefs("qry_HD/DVR")
qdTemp.SQL = sSQL
qdTemp.Close

If Not Forms("frm-HD/DVR_CC").FormFooter.Visible Then
Forms("frm-HD/DVR_CC").FormFooter.Visible = True
Else
'DoCmd.Close acForm, "frm-HD/DVR_CC(Footer)", acSaveNo
End If
DoCmd.OpenForm ("frm-HD/DVR_CC(Footer)"), acNormal, , , , acHidden
Forms("frm-HD/DVR_CC(Footer)").Recalc
Forms("frm-HD/DVR_CC").Refresh
Forms("frm-HD/DVR_CC(Footer)").Refresh
' DoCmd.MoveSize Height:=Forms("frm-HD/DVR_CC(Footer)").WindowHeight + Forms("frm-HD/DVR_CC(Footer)").FormFooter.Height



exit_hd_dvrErr:
Exit Function

hd_dvrErr:
MsgBox Err.Number & "-" & Err.Description
Forms("frm-HD/DVR_CC").FormFooter.Visible = False

Resume exit_hd_dvrErr


End Function



I have used similar code on another form and everytime the search criteria changes the sub form updates to reflect such. I know I am missing something small; can somebody please point it out?:D
I need to have the subform show the updated (choice from combo) criteria.

If this seems to cloudy, please let me know and I will try and revise

View 2 Replies View Related

Forms :: Subform Not Showing Data

May 27, 2015

I have two forms. The first form has individual data to include the person's Social Security Number (SSN). I have another form (subform) that has other data to include the person's SSN. I added the subform to the form (linked the SSN). Unfortunately, only the SSN field appears in the subform. None of the other data in the subform appears in the subform.

View 6 Replies View Related

Forms :: Subform Not Showing Data?

Dec 5, 2013

I have a Subform that is inside a Subform that its only purpose is to display some calculations but for some reason it is blank. Here is a screenshot of what I am dealing with:

See that area under "Pump Calc" that is blank...it should have data in it:

Here is the query that drives that data:

And here is a copy of that subform running in form view:

What am I missing?

View 6 Replies View Related

Forms :: Subform Not Showing Records Sometimes?

May 19, 2014

I have a subform that displays records from a query. Usually, there is no issue. Sometimes, though, the subform stays blank for no apparent reason.

Observations:

-Open form and select relevant information (subform stays blank)

-Open query and 1 record is present

-Go form layout view and turn "Data Entry" on, then back off

(The form appears to refresh when this setting is changed and the subform is displaying the 1 record properly now)

-Close form, re-open, and select the same information as before (subform, again, stays blank)

Again, the subform usually displays the records just fine. It's only sometimes that it has this blank issue even though records are present in its source query. I've tried refresh and requery macros on the form and subform, but that doesn't get the information to show up (though, switching "Data Entry" on and off does).

View 7 Replies View Related

Subform Showing Information From Current Form

Oct 28, 2006

I have a form that shows a subform at the bottom which displays all the corrsponding jobs so that an individual can make the current master form display the specific job information. My problem is I would like the subform list not to display the current master's job as one of the listed ones.


Example:

I have made an order for today and tomorrow. Im looking at the order for today and I see the list of all the jobs I did which is two on the subform. I would like the subform not to display today's job since I am already in it.

View 4 Replies View Related

Reports :: Subform Only Showing Last Group Record

Feb 25, 2014

I have one query that the main form is based on and another query the subform is based on.

I linked the subform to the main form by a common field "Branch"

My main form displays Grouped Employee overhead totals based on Branch

Example:
Branch 1 Employee overhead cost...........15,000.00
Branch 2 Employee overhead cost...........25,000.00

The subform displays grouped branch expense overhead totals based on Branch

Example:
Branch 1 Branch expense...........125,000.00
Branch 2 Branch expense...........155,000.00

I am trying to display both the employee overhead total and branch expense in the Branch Header of the mainform.

Example:
Branch 1 Employee Overhead...15,000.00 Branch Expense...125,000.00
Branch 2 Employee Overhead...25,000.00 Branch Expense...155,000.00

I tried using an IIF statement in a text box in the mainform branch header section to return the branch expense if subform branch = mainform branch.......When I run the report I get all of the Employee overhead but only the last record for Branch 2 branch expense displays.

Example:
Branch 1 Employee Overhead..15,000.00
Branch 2 Employee Overhead..25,000.00 Branch Expense...155,000.00

Then, I tried just putting a text box in the main branch header subreportName.Report.TotalField

When I run the report it returns all employee overhead with the Branch 2 total for every branch in the mainform...

Example:
Branch 1 Employee Overhead..15,000.00 Branch Expense...155,000.00
Branch 2 Employee Overhead..25,000.00 Branch Expense...155,000.00

View 4 Replies View Related

Tables :: Subform Not Showing Correct Records

Jul 26, 2013

Table Info:

EmpProfile: EmpID (Primery Key), EmpFirstName, EmpLastName, Emptitle, EmpPhoneNumber

EmpTimes: EmpID (1 to Many relationship with EmpID primery key), Timein, Break, TimeOut, Totalhours

Query Name:

Selects the table from EmpTimes
Calculates the total hours worked for an empid, on a given day. It produces the total hours as "CalcTime"

Form Info:

1st Form Name: MainForm
Text name to enter empID : Txtempid (unbound)
Record Source: EmpProfile

2nd form name: SFTimeSheet
This is a subform within main form
Record Source: QryTime
Child and master fields are linked using : EmpID

Expecting Result:

When enter empid on the MainForm, in txtempid
subform should retrieve all entries for that empid

Getting result:

regardless what empid entered in txtempid, subform shows only the 1st record available in EmpTimes.

View 3 Replies View Related

General :: Sum On Subform Datasheet - Enter Result To Table Record

Aug 20, 2012

I already make textbox name: TbBanyak on subform footer with control source =sum([Jumlah])

I success display it on mainform with texbox control source =[Jualsubform].[Form]![TbBanyak]

how to enter/record the result to table record??

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved