How Do You Access Recordsource Fields In VBA For A Report??

Oct 28, 2004

I have report in which I have to do some custom calculation in the detail section (using VBA) of the report. How do I access the fields provided by the report, which should come from the query or table fields of the query or table set in the recordsource property of the report in design view. I am able to access some of the fields but not others. Could someone explain to me how this is done.

thank you

View Replies


ADVERTISEMENT

Transfering RecordSource/OrderBy Of Form To Report

Oct 17, 2006

I have a subform within a form that displays filtered data based on dynamic selection criteria which is assigned to the RecordSource/OrderBy of the subform. On this form, I have a "Print Results" button -- OnClick, I would like the RecordSource/OrderBy of the subform to be copied to the Report, then run the report. What I have that doesn't work is:

Reports!rpt_frmTaskMain.RecordSource = Forms!frmTaskMain.frmTaskSub1.RecordSource
Reports!rpt_frmTaskMain.OrderBy = Forms!frmTaskMain.frm.TaskSub1.OrderBy

On execution I get error: "Object doesn't support this property or method"

I am thinking this can be done, and likely have the references wrong. Help?

View 1 Replies View Related

Queries :: Populate Form Fields With Records From A Table Bound To Recordsource

Feb 5, 2014

I would like to populate form fields with records from a table/query so that they are bound to the recordsource and the record to be displayed can be selected from a combobox. I am hoping that in this way, any changes made are propagated to the original table.

I have created a combobox from which the primary key can be selected and added all the fields from the table appearing on this form as values.

In my Change event for the combobox I have this code:

Private Sub cboID_Change()
Me.RecordSource = "SELECT b01_Participants.*FROM b01_Participants WHERE (((b01_Participants.ParticipantID)= " & cboID.Column(1) & "));"
Me.Refresh
End Sub

However, I receive an 3075 error when this code runs which seems to relate to my syntax or an extra ")".

View 14 Replies View Related

Does MS Access Report Support Hide/Show Fields At The Report View Time?

Aug 19, 2007

Does the MS Access Report support Hide/Show specific fields according to parameters or even by click?

View 3 Replies View Related

Forms :: Access 2007 - Binding Control To Form RecordSource With Criteria?

Nov 12, 2013

I have a form with a (large) number of controls which acts as a kind of read-only dashboard of data. The data is split across a number of tables (4, for now, but may grow) I've created a query which amalgamates all of the data from the tables into a single dataset and set that as the RecordSource (Snapshot) of the form. I now want to bind each of the controls to a particular field returned by that query.

However - I have a combobox (same form) which allows users to select a date and I need the controls to update with the relevant data for that date whenever the combobox is changed. The query already returns values for each field over a range of dates so the data is available within the form's RecordSource - I just don't know how to include the date criteria, as specified by the combobox, when binding each individual control?

View 2 Replies View Related

Reports :: Concatenate Fields In Access Report

Apr 27, 2013

I have two address fields that I want to tack together due to space contraints.

=([add1] & " " & [add2])

Seems to work in a query but not report?

View 3 Replies View Related

Modules & VBA :: Routine To Output Access Report To PDF Using Fields

Jul 3, 2013

I have a routine that outputs an MS Access report as a pdf file which works OK. It does not open the file which is what I want.

DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:UsersJEFF1Documents
ptTransactionInvoiceExc VAT.pdf", False

What I would like to do is output the pdf file with a Customer name and number from the field Me.txtAmazonBuyer. I have tried:

DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:UsersJEFF1Documents" + ([Me.txtAmazonBuyer]) + ".pdf", False

But no joy.

View 7 Replies View Related

Reports :: Access 2007 - Report Not Rendering Until Fields Are Clicked

Jul 24, 2014

Upon opening a report (it does this randomly), the report opens and it is completelty blank - no lines, lables, or fields - nothing. However, when I click on an area, the group I clicked on will render and display perfectly. So when this happens, I either have to click every where on the page or scrolling up and down (if the report is long enough) will render the whole report. It doesn't do this everytime; about 25% of the time though.

As you can imagine, when other people use the database and this happens, they freak and just think access is broken. What is causing this or what can be done to prevent this from happening?

I'm using access 2007.

View 9 Replies View Related

Reports :: Scrolling Down Report Changes Report Fields To Errors

Jun 26, 2013

I have an odd thing happening with my reports. There is a main report that gives class information (from query). There are two subreports (from queries also ) with scores (one for each type of test). There are some unbound controls on the main form that display a count of how many scores are recorded which are totals from the subreports. The controls all report the correct numbers however, when I scroll down to view each record, some of them change to #error, or #name, or similar for a moment. Sometimes they will stay in error form when I stop scrolling but change to correct if I scroll up just a bit. Is this because the controls won't calculate unless that report record has focus?

View 1 Replies View Related

Using Sql To Set A A Reports Recordsource

May 18, 2006

Using this code as part of a module to open a report in print preview and set it's recordsource to the sql I have written earlier in the code. The problem is when I run this it only prints the report it won't show it to me in print preview like I want. Anybody know what's wrong? Thanks...


DoCmd.OpenReport "SitesIssues_qry", acViewNormal, "", "", acNormal
Me.RecordSource = strsql & " " & strWhere & "" & strOrder

View 2 Replies View Related

Setting RecordSource In VBA

Jan 26, 2005

This is driving me mad. I'm trying to copy a table and form from a template.
They both copy fine, but when I try to change the new forms recordsource property, nothing happens.

Private Sub CreateQuiz_Click()
'copy structure from existing BLANK table
a = InputBox("Name of new table", "Create new Quiz")
DoCmd.CopyObject , a, acTable, "BLANK"

DoCmd.OpenForm ("BLANK")
Forms!BLANK.RecordSource = a
Forms!BLANK.Close
DoCmd.CopyObject , a, acForm, "BLANK"
Forms!a.RecordSource = a

End Sub

Any help would be much appreciated.

View 1 Replies View Related

Setting RecordSource

Jan 27, 2005

Hi All
I have a Main Form, This Main Form has a Subform, the SourceObject for the subform is another form.
What I am trying to do is to set the RecordSource for the SourceObject Form from within the code behind the main form so i can use the same form with various queries.
Appreciate any help - thanks

View 2 Replies View Related

Listbox Recordsource Value

May 27, 2005

How do I determine what value my listbox has?

Here is what generates the records from Form 2:

If Not IsNull(Me.[StartDate]) And Not IsNull(Me.[EndDate]) Then
strCriteria = strCriteria & "tblWO.Created Between #" & _
Format(Me.[StartDate], "m/d/yyyy") & "# And #" & _
Format(Me.[EndDate], "m/d/yyyy") & "#"

strSql = "SELECT DISTINCT [WOnumber],[Requested],[UDF1],[RequestedBy]," & _
"[Status],[property],[asset]" & _
"FROM tblWO " & strCriteria

Forms("frmFilter").Listbox1.RowSource = strSql

What I am trying to do is trigger a message box from the onclick of a command button on Form 2 and read the listbox # records on Form 1. It's gotta be something simple in my syntax. Search hasnt provided this scenario for me. I have tried these and more:

'If Forms("frmFilter").RecordsetClone.RecordCount = 0 Then
'If IsNull(Forms("frmFilter")).Listbox1 Then
'If Forms("frmFilter").Listbox1.RowSource = 0 Then
'If Forms("frmFilter").Listbox1.RowSource = Null Then
'If [Forms]![FrmFilter]![Listbox1.recordcount] = 0 Then
'If Forms("frmFilter").Listbox1.RecordCount = 0 Then
'If Forms("frmFilter").Listbox1.RecordCount = "" Then
'If Forms("frmFilter").Listbox1.RecordCount = Null Then

MsgBox "Sorry, no records meet your chosen dates. Change the dates and try again."

View 2 Replies View Related

Recordsource Of Subform

May 30, 2005

Hi everybody,
I have a form with its tabbed subforms' recordsource determined by the code:

Private Sub childTvl_Enter()

Me.childTvl.Form.RecordSource = "SELECT * FROM tblTvlInput WHERE tblTvlInput.Dept = """ & Forms.frmBudget.txtDept & """"

End Sub

This is to filter the huge data by department and only allowing the specified department to view their code. However, I find it slow and pesky as it only shows the required information when the user clicks on the child. I have tried putting the code above elsewhere but to no avail.

Is there a better way of speeding the filter as well as showing the user his own records when he clicks on the tab?

Thanks in advance. =)
You guys here are saviours!

View 3 Replies View Related

Recordsource Delima

Sep 26, 2005

I am trying to correctly code a Record Source value in a Form's 'On Open' Event . I first captured parm data from the calling Form, (Last Name, and First Name) to be used in the query as follows:

Private Sub Form_Open(Cancel As Integer)
Dim intI As Integer
intI = InStr(Me.OpenArgs, ";")
SearchFirstName = Left(Me.OpenArgs, intI - 1)
SearchLastName = Mid(Me.OpenArgs, intI + 1)
Me.RecordSource = "SELECT tblName.LastName, tblName.FirstName WHERE tblName.LastName = SearchLastName and tblName.FirstName = SearchFirstName"
End Sub

If I leave off the 'WHERE' clause, I get all the records in the table, so I am sure the syntax in that area is all wrong.

View 2 Replies View Related

Set Forms Recordsource

Nov 24, 2005

Is there a way to set the recordsource for a form before it opens? I've got Me.recordsource = "QryNewCaseForm" on the On Open event of the form but I toggle between recordsources once the form is open and if I close it while the recordsource is "QryCaseForm" it won't open as "qryNewCaseForm" the next time I open it.

View 2 Replies View Related

SubForms RecordSource

Oct 31, 2006

Today my client asked me to do something strange.

He wanted a field to be in the subform which was originally part of the parent form and is still part of the parent table.

(Hence, when I change the field in one subform line it would change for all other subform lines related to the current parent record) He insists to put this in the subform and it should be Editable there.

I accomplished this by basically putting a 'Parent table' join 'Child table' query in the subform so I could have access to this one field. Orginially I just had a query with the Child Table but to get access to that one field (and to make it editable) I made this extra join.

I don't like this design eventhough it works..... Any suggestions on how to effectively implement this.

Also I don't understand how Access still knows what to do using the Parent Link And Child Link fields (Located in the Subform Control). How does Access know to create a new record in the Subtable and not in the Parent Table when both are present in my subform's record source now.

View 1 Replies View Related

Reports :: Unbound Report - Print Preview OK But None Of Fields Print When Report Directly Send To Printer

May 25, 2013

I have an unbound form with an associated report. When the user hits the 'print' button on the form/screen, the report is launched in the background. In the On Load event of the report I populate the report fields from the forms field as so:

Code:
Me.txtAddrMainLine2 = "NAME " & UCase([Forms]![frm_OrderRx].[txtPatientName])

This works like a charm as long as I call the report in Print Preview mode (i.e. with acViewPreview). But if I send the report directly to the printer, none of the fields print.

I've read about using other report events to populate the fields (e.g., On Format and On Print) and also something about using TempVars to pass the data. But I haven't read anything that's clear and definitive about the full answer.

View 3 Replies View Related

Combo Recordsource (dynamic)

Mar 2, 2005

Hello,

I have a combo box that i would like to dynamically change the recordsource (what values are available in the dropdown) based off of the criteria in another field. Basically, I want to switch which query the combo points to.

I am looking to do something like...

If field1 = nulll
combo recordsource = query1 (a list of values from table1)
Else
combo recordsource = quer2 (a list of values from table2)


I am looking to switch which query the combo is populated with, not limit the rows based on field1.

Any Ideas for this? Thanks!

View 3 Replies View Related

Change Subform Recordsource

Sep 4, 2006

I have a form with 5 tabs. Each tab has 2 subforms.
When the form loads I am trying to select it's recordsource by doing this:

Me!Subformname_A.RecordSource = "SELECT FieldA, FieldB FROM TableA WHERE"

However, it throws an error.
Is there something wrong with this ?

View 1 Replies View Related

RecordSource Change For Reports?

Sep 26, 2005

I have a report that can be used for 3 different queries. I've been trying for the last hour or so to get three different buttons on a form to open this report but give it an appropriate record source.
I figured there's got to be a way that's easier than three queries, and three reports...?
I was trying to use the same format as with forms :
[Reports]![rptReportName].recordsource = "qryQueryName"

or variations of that. Am I way off? It keeps saying that I've misspelled the name or it doesn't exist.

View 7 Replies View Related

Changing Navigation Recordsource To Query

Apr 10, 2006

Hello,

I'm trying to create navigation buttons that navigate in alphabetical order. I know that the easiest way to do this is by creating a query and using the query as the recordsource for my navigation buttons, but for the life of me I cannot figure out how to actually change to the recordsource to that query for only that navigation button.

I'd appreciate any help

Thank you
PRHC

View 2 Replies View Related

Changing Subform RecordSource Will Not Stick

Apr 18, 2005

Weird yet aggravating problem.

I am trying to setup a routine that will allow the user to change the RecordSource of a subform. The RecordSource is being changed yet once I move to another record the subform is reverting back to the original subform RecordSource. I am using the below command to change the subforms RecordSource...

Me.MySubformName.Form.RecordSource = MySQL
I even to make a copy of the subform and I changed the table it is linked to yet I got the same result

Me.MySubformName.SourceObject = "MyOtherSubForm"

There are no functions in the record selectors that would interfere with the subforms RecordSource.

Any suggestions as to why the RecordSource of my subform will not "stick" when I move to another record?

Thanks in advance for your help!

View 8 Replies View Related

Changing Subform's Recordsource With OnCurrent

Jun 29, 2005

Hi

I have problems working with a 3 level form

I have one main form called Projects

Depending on the record on the form Projects, the subform called Products will display the correct info

And on the OnCurrent event of the form Products, it will display the correct info for another subform called Product_Info

The problem is, the subform called Product_Info is dependant on a field on the Projects form, and on a field on the Products form so I cannot directly link the Product_Info form with either the Projects of Products form

What I'm doing is changing the recordsource of the Product_Info subform on the OnCurrent event of the Products subform but for some reason it won't work

If I display the recordsource of the Product_Info subform, it displays the right recordsource triggered on the OnCurrent event of the Products subform, but the data doesn't display

Thanks

View 3 Replies View Related

Field With Data From A Different Query Than RecordSource

Aug 31, 2005

I have a form that pulls data from a big joined RecordSource query. This form needs to be editable. I need to add a field on the form that will contain a value, which is actually the sum of numbers from several records. Because that sum value includes arithmetic in the query itself, I'm assuming that is why the results of the query are not editable. I tried joining the Query that gets that sum value into the main RecordSource statement, but because the sum Query is not editable, doing that renders the whole form uneditable.

I am new to working with Access forms, and VBA in general. I have a lot of experience using VBscript, though. I was asked to get this done and now I have to fight my way through it. I'm hoping there is maybe a way to write a function that will query for the sum value based on the current ID on the Form. The main form cycles through records, and the sum value is a total of points for the record shown in the form. So as each record loads into the form, I need to get the points total that matches that record's ID and display it. The points total does not need to be editable.

Any suggestions for a newbie on how to solve this?

View 2 Replies View Related

SubSubForm ControlSource/RecordSource Problem

Nov 4, 2005

I have a form with two subforms. One of the subforms has five subforms (subsubforms).

The ControlSource and the (query sequence for each) RecordSource of each of the subsubforms are created on-the-fly. The subsubforms have no Master/Child relationships specified. The subsubform merely display various filtered and various grouped subtotals of the 1st subform. Summing and grouping on the subsubforms prevents my using Master/Child properties.

On the AfterUpdate event on any of the filter fields on the form the ControlSources and RecordSources are rebuilt and the form becomes invisible for some reason and appears to hang, even after stepping through all the (class module) code with the debugger. Repeadedly clicking both Maximize and Restore buttons on the form's button on the Status Bar followed by clicking a 2nd form's toolbar icon causes the form to become visible under the 2nd form. The tool bar are also not visible, just a large brow bar at the top of the form. Moving the mouse over the toolbars causes individual icons to become visible or raised.

What am I missing?

Maybe I should calculate the values using DAO recordsets and backfill unbound subsubforms.

Thank you in advance for your thoughts.

View 1 Replies View Related







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