I've Never Passed A Variable Between Forms... This Is A First!

Jun 10, 2005

:D
I have a form set up where a user chooses a page tab. Either statistical reports or detail reports. Then they have to choose between 2 toggle buttons. Candidate or hire.

So a user chooses detail, then candidate. An option group below that shows the different groupings of detail candidate reports that they can choose.

A couple of examples - detail report of candidates by office applied to, department, application source etc.

Once that is chosen a button is visible to continue. Now they are taken to the appropriate form. This is done by a global variable gstrformname defined in the afterupdate of the group option that they chose (office etc.)

Once they click to continue to the criteria form, they are choosing the criteria. (for example purposes) the choice below takes the user to a criteria form for choosing an application source ( email, monster.com etc) or click a button and all types are given. I have all of that set up. But now I want to change what report the command button is opening, to a variable. A variable that would be set by the below form when the type of report and grouping for the report are chosen...that defines a certain report.

I specified on this main report menu that it is a candidate report that I want, but when I get to the criteria form, I need a way to pass that choice on. I am not sure how to best do that.

I am trying to avoid making 2 copies of the same form 1 for candidates and 1 for hire. :crazy: I undertstand that I should pass a variable here.

So basically on the main form they choose candidate or hire report, then they choose group. The grouping information tells the command button what form to open (the application source criteria form, the office criteria form, etc). The thing is, this form is the criteria for the candidate report and the hire report. The command button on the criteria form would ideally be -

docmd.previewreport gstrreportname, acpreview

my question is, how or where do I define, from the point that they choose candidate or hire, to the next form, that they want the candidate by office or hire by office report? (define the gstrreportname variable as one of those too.)

Make sense?

Here is a pick of the report form (menu)
http://www.geocities.com/misscrf/reportmenu.jpg


For the afterupdate of the frame for the grouping of the report, I have a select case. In that I define gstrreportname for the report it is, if the choice goes right to a report. If it goes to a form first (for criteria), I define that form with a global variable gstrformname. Can I also define the report there (gstrreportname)? If I do that, will the criteria form know that? Even if I close the main report form?


I hope someone understands me! :shrug:

View Replies


ADVERTISEMENT

Form Variable Passed To Query

May 7, 2007

Not sure if I am asking the right question, but....

I would like to pass a string variable to a query but it does not seem to work.

In the query, my criteria for the date field is (and works):

>=[forms]![frmDisposition]![FromDate] And <=[forms]![frmDisposition]![ToDate]

But, this is not working for the ID field criteria:

[forms]![frmDisposition]![ID]

In the forms code, I have a string based on the result of 3 check box. I tried using an unbound (ID) control to display the string so I know that the value of the string is correct. EX: "FW" Or "MA" Or "PD"

Is it possible to pass the value of the string to the query or do I need to try and pass the value of the unbound control to the query?

View 6 Replies View Related

Modules & VBA :: Public Variable Passed Back To Private Sub

Sep 26, 2014

I've got a private sub that runs when the form loads. I want it to get the id of the record which has opened this new form.

The public sub populates the variable but it's Empty going back into my private sub. I'm sure its a simple school boy error but it has me stumped!

I want it public as I need to keep that id as new records are added in the form.

Private Sub Form_Load()
FRStudentFundingRequestID
'fundingrequest = FundinRequestID
Me.txtFKFReq = FundingRequest
End Sub
__________________________________
Public Sub FRStudentFundingRequestID()
FundingRequest = [Forms]![frmFundingRequest]![txtpk]
End Sub

View 3 Replies View Related

Forms :: How To Find What Data Is Actually Being Passed Between Forms And Subforms

Nov 22, 2013

I have several Suppliers, each of whom holds several SalesEvents. At each SalesEvent I might buy none, one or more Bundles. Each Bundle then contains one or more Items. These relationships are all reflected in my Access 2013 desktop db as one-many relationships with cascaded updates.

My form structure for data entry reflects the Relationships, in that I have a Supplier form with a SalesEvents subform. On that subform I can enter data about each of that Supplier's SalesEvents, and each SalesEvent row has a button to call up a SalesEvent form which has a Bundles subform. Then each row of that subform has a button which calls up a Bundle form containing an Items subform. That Bundle form identifies the Supplier, Sales Event and Bundle number, and within its Items subform I can then enter the data for each Item.

Problem : All used to work fine, but I've clearly changed something because now when I select the Items button on the Items subform in the Bundle form, the system gives me the data for the first record in the SalesEvents table, rather than the one selected. I have checked the raw data and that's as it should be. I have tried to undo all the steps I took since it last worked properly, but to no avail. Restoring the last backup (taken when I'm sure it worked properly) still has the problem.how do I find what data is actually being passed between forms and subforms ?

View 3 Replies View Related

Forms :: Field Not Being Passed To Query As Criteria?

Apr 18, 2013

Instead of the combo box value being passed into the target query as it should I *always* receive a popup that states "Enter Parameter Value"

I set my filter criteria as such in the target query: "[Forms]![Invoice_Form]![comboFamily]" but for some reason, despite there being a value in that combo box, I am always prompted for a parameter. VBA code associated with a "Generate Invoice" button on the form causes the query and the report to open.

I've attached the database, everything is dummy data.

The suspect form is the "Invoice_Form" the suspect query is the "Invoice_Query" and the suspect report is the "Invoice".

If a number is entered in the "Enter Parameter Value" field that matches the primary key of a family in the "Family" table then a report is generated correctly (as it is currently configured). For some reason it seems that the form with the combo box just cannot be accessed by the query.

View 4 Replies View Related

Forms :: Open Form If Date Field Is Passed?

Apr 15, 2013

I have a form with numerous fields on it, with the one I'm concerned about being a date field.

I want a different form to open automatically if the above date field is in the past (this will act as a warning to the user).

I've created the warning form as a pop-up view but just want to know the best way to have it open automatically.

Can this be done via a macro in the OnOpen Property (or maybe OnLoad) or will this have to written in vba.

View 7 Replies View Related

Forms :: Result From A Query Being Passed To Text Box On Form

May 6, 2014

I am making a database for my work place where there is telephone counsellors and they need to complete a certain number of supervision hours and a few other categories of hours required for training and several other things. The manager wants to be able to see the total supervision hours and the other categories for a worker when the worker is selected and the date range for the queried time entered.

I have a form that has quite a few items on it. I have two text boxes that allow me to enter a start date and an end date, I have a combo box that allows me to select a worker and I have 3 text boxes that I want to populate with the sum of 3 separate columns in another table when the date is entered and the worker selected so the manager can see, at a glance, how many hours each worker has done on the separate items. Maybe I would need an update button at the bottom that, when clicked, would perform the required calculations.

I have 3 queries that return the required information but I need to get one of the columns from the query results put into each of the 3 text boxes. Basically, when I click on the buttons the right query appears, I just want column 3 (which is a sum column) to get put in the corresponding text box and I want all the boxes to display the sum of their corresponding queries when a date and person is selected.The form is called frmSearch, the 3 queries are called qry_sumisshours, qry_sumisshours and qry_sumtcshours. The 3 text boxes I need to get populated from the queries are called txt_ results_ sv_ hours, txt_results_TCS_hours and txt_results_iss_hours.

View 10 Replies View Related

Forms :: Continuous Form - Saving New Record When Data Passed To It

Dec 11, 2013

I have a continuous form it has a field (DateStart) and a field (DateStartCarryOver). There is an event on (DateStart) for the (DateStart.Value) to be passed to a new record in (DateStartCarryOver).

My probem is that the new record dosent get saved (i.e. it dosent get an ID so a record isnt created. How can I create that record once the data has bee pased to it?

View 3 Replies View Related

Forms :: Calculate Passed Working Days And Show Them In A Form

Jul 8, 2015

I need to calculate the passed working days and show them in a form. I should be also able to use the number in a query later on. in excel I use the formula to get the days passed:

Code:
=IF(ISERROR(MATCH(F10,Dictionary!C:C,0)),NETWORKDAYS(D10, TODAY(), Dictionary!$E$2:$E$43),"Status Excluded")
D = "Date_uploaded" in access table "tbl_All_Cases"
F = "Status_Case" in access table "tbl_All_Cases"
c:c = dictionary case status
E:E = dictionary holidays

"Status Excluded" will show up in the cell if a case has one of the status from the dictionary..I created a table: tbl_Dictionary where there are 2 fields: "Case_Status" and "Holidays".How can I translate the above formula into something that access will understand?

View 14 Replies View Related

Forms :: How Data Is Passed Using Foreign Keys - Cannot Display Proper Information

Jan 25, 2015

I'm trying to understand how data is passed using foreign keys.

I'm using Allen Browne's 'Don't use Yes/No fields to store preferences' at: [URL] ....

I've also downloaded his sample DB, RelationBasics, to use as a guide.

Attached is my version of the Student / Sport DB as described on the webpage.

I use 2010 at home (saved as 2003 version) and 2003 at work (JPNSE OS). Both result in the same thing.

The problem I'm having is I cannot get the actual sports to display in the combo-box, only the Sport_ID number.

I've tried building both forms with and without actual data in the TBL_Student & TBL_Sports tables, but no mater what the result is the same.

View 2 Replies View Related

Forms :: Conditional Formatting Changing Field Color Based On Hours Passed

Jan 7, 2015

I'm having a spot of trouble trying to get conditional formatting to work. I have an overview form which displays current quotes going through the system, the QuoteStartTime field is generated from the Now() command.I Would like if possible to show, 1 hour = Green, 2 hours = Amber and 3+ hours Red.

I've tried variations of
hour([QuoteStart])>1
DateAdd("h",1,[QuoteStartTime])

I've done this before with a date only field before, but working with time is taking too much time.

View 1 Replies View Related

Forms :: Using ID Value Passed To Form From Previous Form In Query

Aug 17, 2014

I have a big table, EquipmentDetails and separately I have job plans.Job plans can have many pieces of equipment. I store the relationship in EquipmentDetails_JobPlanDetails, but am feeling frustrated as I can't seem to get Access to build the SQL query from this in the way I want.

I am generating a List Box in a form which is populated from a query.The query calls on a table which lists ItemID from EquipmentDetails and JobID and in the current form (where the list box is) I want to pick up and display the ItemIDs associated with that JobID. The current JobID reaches my form correctly (I've proven this by displaying it in a text box) from the previous form.

The problem I have is that I can't seem to get the SQL query to only get ItemIDs that are linked to the current JobID. No matter what I try, it either gets all of the ones in that table, or I can't compose one.What kind of SQL do I need to only grab the ones relating to the current JobID please?I've tried building it in the design view but it says that it can't do it because the outer joins are ambiguous.

View 2 Replies View Related

Reports :: Subform Field Linker Error - Obj Variable Or With Block Variable Not Set

Apr 16, 2013

I am creating a 2 level report to confirm an order. Main report already created, runs successfully called as subform/subreport under "OrderDetails" form. Linked to master using Order.ID. There are two versions of the confirmation report that have different layouts for different program types.

The hangup comes when I try to add a "Class Dates" subreport. It lists dates of individual classes and Skip dates. I have created the subreport as "srClassDates". When I add it to the main report, it lists the records. However, when I try to link it to the Main report, an error message box appears with the "object variable or With block variable not set".

I have tried rebuilding both the main and subreports, rebuilt the query, have not found anything that changes the result.

Linker has been working successfully on other subforms. Report with groupings works fine, but I need data from 2 tables both linked to order.id.

View 2 Replies View Related

Combo BOx Filter Issues - Can Get Passed It

Jan 15, 2008

Okay I created a database that I am going to use to collect data about a study we are doing.When a participant is added to the database on the main (Participation Details form), it automatically generates an ID and creates a record in a second table/form - a questionnaire (i.e. Athens Questionnaire) that the participants fill out preserving the ID number that was created in the participation details form (I have been able to achieve this).However what I wanted to do next is be able to filter the Athens questionnaire using a combo box which contained all the participant's ID's.I was able to create the combo-box and populate it with the ID's using a query and did not put a control source on it (i used =tblAthens.ParticipantID ....) iand created a sub-form that contained the questionnaire. I did this by creating the questionnaire in a separate form called frmAthens_sub and dragging it from the "explorer window" into my open Athens Questionnaire form. However when I attempted to place code in the "After Update" field of the combo box I keep getting errors and I am not sure why.The code I am using is:Option Compare DatabaseSub SetFilter() Dim LSQL As String LSQL = "select * from tblAthens" LSQL = LSQL & " where ParticipantID = '" & cboSelected & "'" Form_frmAthens_sub.RecordSource = LSQL End SubPrivate Sub cboSelected_AfterUpdate() 'Call subroutine to set filter based on selected ParticipantID SetFilter End SubPrivate Sub Form_Open(Cancel As Integer) 'Call subroutine to set filter based on selected ParticipantID SetFilter End SubIt is highly possible that I am just not doing something right as this is the first time I have used sub-forms. I tried to attach a copy of the database but cant get it below the max. The error seems to be coming from this line --> Form_frmAthens_sub.RecordSource = LSQLIs there an easier way or alternative code for filtering a sub-form from a combo-box?

View 3 Replies View Related

Criteria Is Passed By Function Call

Aug 10, 2007

Dear Access Query Expert

I have created a query which has a function call as the criteria for one of the numerical fields. The function returns a string expression such as .....

1) 132 OR 142 OR 156
2) 132 OR 142
3) 132

..... into the criteria section of the numerical field.

Unfortunately, the query doesn't work if the criteria is generated by the function call. However, if I hardcode the criteria (don't send a function call but directly write 132 OR 142 OR 156) the query works.

I am puzzled and I am not sure how to solve this problem.

Thank you so much.

View 1 Replies View Related

Stop Moving Passed Last Record

Sep 11, 2005

I am writing a database with a number of tables with forms attached to each table. I have placed navigation buttons on each form to move to first, last, next, previous. I have set up the code associated with the buttons as "public sub" so it is available for each form to use.

This was working OK except that when I used the NEXT button at the last record it would open a new blank record & keep opening a new blank record on each click.

To over overcome this I put in an If statement to check if it had moved to a new record. To do this I used the following:

If Me!NewRecord Then ..... etc

Now I get an error "Invalid use of Me key word" I suspect it is because I am using ME in a public sub

How do I overcome the problem of moving passed the last record and still have the coding available to all forms?


The Code is below.

Thanks for any help.



Public Sub Next_Record_Click()
On Error GoTo Err_Next_Record_Click

DoCmd.GoToRecord , , acNext

If Me!NewRecord Then
' If new record move back to previous
DoCmd.GoToRecord , , acNext
' Send message
MsgBox "This is the last record", , "No More Records"

End If


Exit_Next_Record_Click:
Exit Sub

Err_Next_Record_Click:
MsgBox Err.Description
Resume Exit_Next_Record_Click

End Sub

View 3 Replies View Related

Bound Column Passed To Textbox

Oct 29, 2006

I have a combo box that has 3 columns. What I am trying to do is get the third column to be passed as the value to another textbox after the combo box is selected.

combo box sample data: Male/John/NY
the 3rd Column which is state I would like to have it sent to the State Field...

View 2 Replies View Related

How To Correctly Set Fields That Would Be Passed To Macros

Apr 15, 2013

I currently have a form that asks for 2 fields to be filled with data to be passed to 3 separate macros that will then run a set of about 10-15 queries based on the values entered in the form. This used to be sufficient as the manually entered data was only a small set. Now the number of values that need to be run through the macros is starting to become too large to constantly be changing the values and running the macros. I can set up a table that will contain all the value combinations that would need to be entered into the form to then be passed to the queries, but how can I set this up to be done automatically. I know it can be set up using a loop, but I'm not familiar with VBA code (most of my access work is done using the design tools) so I'm not sure how to correctly set the fields that would be passed to my macros. I can also deal with the values being passed to my form one at a time, then have the macro run on that set of values, then have the next value sent to the form, etc . . .

I have a table set up with data for all stores that I'm querying. I need to select the REPORT_BRAND and store_no from this table and run about 10-15 queries that will sort the data properly for a dedupe that will be performed at the end. The form that is set up asks for the REPORT_BRAND and store_no, then it gets passed to the macros which will create the tables for store #1. The values in the Form then get replaced with the next report_brand and store_no and the macros get run again for store #2. At the end of all the stores, I have 2 tables setup with all the final results for each store. These 2 tables then provide the results that I then manipulate to fill in the reports that are required. I need to run each store separately because the results as based on total record percentages by store.

I want to remove the manual intervention from the procedure and just have a table feed the form (or eliminate the form all together) and have the macros run for all stores on my table.

I've searched around and have seen a lot of examples of using a loop, but not being familiar with VBA makes understanding exactly what I need to enter for my specific data a bit difficult.

View 2 Replies View Related

Queries :: Parameter Not Getting Passed From Combo Box To A Query

Jan 29, 2015

I am new to access. I have created a form in which I used a combo to show Main Area Name. this value is passed into a query to show only area under main area only. Created another combo to activate the query to show the area.

View 6 Replies View Related

Modules & VBA :: Error 91 - Object Variable Or With Block Variable Not Set

Jul 8, 2013

Error 91 - Object variable or With block variable not set

I am getting this error telling me that an object variable is not set.

I know which variable it is but when I step through the debugger it sets the variable and all is fine? Issue is that public variable of a class is not getting set when the VBA Editor is not open?

View 14 Replies View Related

Modules & VBA :: Sorting / Object Variable Or With Block Variable Not Set

Oct 3, 2014

This code runs fine the FIRST time, however trows up a message the SECOND time it is run.

The error is on the line ".Range"

I am trying to sort records which have been exported to Excel.

Dim LR As Integer
LR = 5
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wbRef = xlApp.Workbooks.Add
With wbRef

wbRef.Activate
.Worksheets("Sheet1").Activate
With ActiveSheet
.Range("A2", .Cells(LR, "O").End(xlUp)).Sort Key1:=.Range("C2"), Order1:=xlAscending, Header:=xlYes
End With
end With

View 3 Replies View Related

Modules & VBA :: Checkbox True When Current Date Is Passed

Dec 3, 2014

I have a form that allows you to search for records and displays all the information for that project, typical stuff.

On this form is a subform with the followings Fields:

Inspection Requested, Inspection Due, Inspection Done, Overdue

When you update inspection requested the inspection due is automatically updated to 30 work days from that day.

Now what I'm trying to do is get the overdue field (it's a yes/no field) to automatically check itself when the current date is passed the inspection due and the inspection done field is blank.

Here's what I have that isn't working:

Code:
Private Sub Form_Current()
If DateAddW([REQUEST], 30) < Date And [INSPECT DONE] = 0 Then
[OVERDUE] = True
End If
End Sub

DateAddW is a UDF that works just fine. I've tried replacing 0 with Null and neither works.

View 4 Replies View Related

Showing Null Values When Calculating Days Passed?

Feb 24, 2012

I am using workdays to calculate time passed between two dates. I also have a table for Holidays that I don't want counted as work days. This is working well, but I would like my queries to show a null value instead of showing #Error when a date field is empty. Here is my coding in my Module.

Option Compare Database
Option Explicit
Public Function Workdays(ByRef startDate As Date, _
ByRef endDate As Date, _
Optional ByVal strHolidays As String = "Holidays" _
) As Integer

[code]....

View 3 Replies View Related

Passing Variable Between Forms

Aug 8, 2006

Hi Everyone,

I'm trying to pass a variable called MyFilter between forms but am having problems. I have created a Module and declared MyFilter as a public string.

The original code in my first form is:

Private Sub Command65_Click()
Dim MyFilter As String
If Me.Filter = "" Then
MsgBox "Please apply a filter to the form first."
ElseIf Me.Dirty Then
' Make sure the record is saved
RunCommand acCmdSaveRecord
Else
MyFilter = Me.Filter
DoCmd.OpenReport "Temp", acViewPreview, , MyFilter

End If
End Sub

How to I change this so that it now stores the value in the Public variable instead of the Private one which it is doing above?

Thanks,

View 5 Replies View Related

Forms :: Using Variable As Fieldname?

Aug 8, 2013

I have a form with 48 unbound text fields name txt1 to txt48.

These are to represent 24 hrs in half hours, to visually represent the hours capacity of my workshop. Now if I choose a date, which is say Monday, I check my settings, and see that the workshop has a capacity of 15 hrs on a monday. Now I would like to in a loop set the backcolour of the remaining fields to red.

Something like for I = 15 (workshop capacity) to 48

me."txt" & I.backcolour=1111
next I

View 3 Replies View Related

Forms :: Using Variable For Form Name?

Feb 21, 2014

Is there a way to use a variable instead of a form name?

e.g. FRM1 is a form

Forms![FRM1]!textbox1.SetFocus

Instead of FRM1 , a variable is used which can be any other form name.??????

View 10 Replies View Related







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