Problem Storing A Value Calculated By Unbound Text Boxes
Mar 6, 2006
I have 3 values in unbound text boxes and a 4th text box that is calculating the sum of the first three text boxes, i need the result of the calculation to be stored in the field "Total Cost" that is also on this form.
I am running in to a brick wall with this. I have an unbound text box with the control source set to =IIF([text42]=0,0,[text42]/[text44])*100 and in continues to return a #name? error.
I am not sure how to get this expression to work. I have even tried to put =[text42]/[text44] and I still get the #name? error.
What i'm trying to do is fill several unbound text boxes on a form.
I have an "Employeetbl" with "Employeename" and a "Projecttbl" with "Projectname". what i want to do is have about 10 text boxes from left to right on my form. Then fill these with all the employee names from my "Employeetbl". Underneath this i will have about 10 text boxes from top to bottom and i'd like to fill these with the project name from the "Projecttbl"
Lets say I have a form called form1 with 2 subforms named subform1 & subform2.
Can I place a text box on form1 that totals fields located on subform1 & subform2?
This is what I currently have as an expression in the text box. It is in the before update event, which may be the problem. Any ideas or solutions are much appreciated. :)
I am having a little problem with making an audit trail for a form with some unbound text controls on it.
Since .OldValue won't work on unbound text boxes, google suggested that I put the old value in the control's tag property. This is what I came up with:
Code: Dim ctl, tbox As Control Dim strName, strOLD, StrNew, NewTag As String Dim NextOne As Label For Each tbox In Me.Controls If TypeName(tbox) = "TextBox" Then Select Case tbox.Value
[Code] ....
The first loop is supposed to dynamically assign the tag value, with whatever the textbox value is, however it doesn't. I've asterisked out the line i think may be the issue.
I have 10 unbound textboxes with the Tag Name "LoopID" in my report. I have to display the "PatientNumbers" field from the table tblPatient in those text boxes. Below is my code.
When I run the report, I get the error message: Run-time error '2448.' You can't assign value to this object and the code "Ctl.Value = rst!LCANumber" is highlighted.
Private Sub Report_Current() Dim strSql As String Dim dbs As Database Dim rst As Recordset Dim x As Integer Dim Ctl As Control strSql = "Select PatientNumber from tblPatient"
I want people to be able to search, or jump to a record by the PO #
I am hoping to just do it in the form, and by that I mean, the user is on the Purchase Order form and needs to look at a previous Purchase Order for editing, deleting, etc. and to just type it in the text box, hit the search button, and there it is.
2 Forms 1) - Employee Details (source control is "QEmployees Extended") 2) - Employee List (source control is "QEmployees Extended")
in Form "Employee Details" there is field named "HireDate" this field is also found in the table (records) "Employees" and "QEmployees Extended".When Form "Employee Details" is ran the "HireDate" appears as it should in the "HireDate" text box.
What I want to do is add a unbound text box to Form "Employee Details" named "txtYrsEmp" (Years Employed). and perform a calculation that will take the "HireDate" (date) and compare it to "Todays Date" and come up with the number of years employed rounded by 2 and show this result in the unbound text box called "txtYrsEmp"
Now I did a Qurey just to see if I could calculate what I wanted- "QYrsEmp" where in the first column I entered in the Field row (top) Expr1: EmployeeID from table Employee and in the second column I entered in the Field row (top) txtYrsEmp: Round(DateDiff("d"'[HireDate],NOW()/365.25,2))
Now the query returns the exact results I want so I know the calculation is possible at least here in the query.
On a form I'm asking a user to enter dates in 2 different textboxes, say, [text1] and [text2], both formatted to short date. In a third textbox [text3] I need to see the date of the greater of the two, and in a fourth [text4] I need to see the date of [text3] if it falls on a Monday through Friday, or the date of the previous Friday if [text3] falls on Saturday, and the date of the following Monday if [text3] falls on a Sunday.
...a couple quick examples;
If text1 = 2/20/2015 and text2 = 2/27/2015, text3 should evaluate to 2/27/2015, and text4 should evaluate to 2/27/2015 or If text1 = 2/20/2015 and text2 = 2/28/2015, text3 should evaluate to 2/28/2015, and text4 should evaluate to 2/27/2015
My attempts to compare text1 and text2 revolve around an IIF but result in an error...
Entering this into [text3]... IIF([text1]>[text2], [text1], [text2])
results in "#Name?" error, which I interpret as meaning the date from the source cannot be pulled into the formula.In attempt to check the day of week, I used =Weekday([text3],1) which results in a number. I haven't been able to do an IIF on it as it errors with #Name? again.
The layout: I have form1 listed in continuous view. I have about 10 fields being listed. I have unbound text boxes for each field in the form header designated as a filter for each field.
Ideal world: Have each filter update records as you type. But I would also like for a "cascade" effect on the filters as well. Being that I can type in a few letters in FilterField1, and type in a few letters in FilterField2 and it would only display the records where the criteria is met for both filters.
What I'm not looking for: Only applying 1 filter at a time for 1 field. I have this setup now, but would like it to be more versatile allowing several fields to be filtered at once.
As a part of reducing traffic on file server, I am planning to read less record on the form and hence I tried removing forms record source. (Attached sample db)
I kept all unbound textboxes onto the forms and save new record to the table using codes back of the command button. This is working great with main form. But doesn’t with sub form. I tried removing record source of sub form and keeping unbound text boxes to appear record if it exists.
If you enter 1 in InvNum text box on main form, you will find it brings record. I don’t want to show the record on the sub form unless I call it from main form.
How can I use the same trick of unbound text boxes with sub form too?
I have a form that utilizes a combo box called cboProgAddr (for Program Address). The cbox has 5 columns each of which fills in an adjacent text box. Since I needed the option of making corrections to these text boxes once they were filled in I need to set them up as unbound via the following code in the After Update event of cboProgAddr:
Private Sub cboProgAddr_AfterUpdate() Me!txtProgStreet.Value = Me!cboProgAddr.Column(1) Me!txtLocStreet.Value = Me!cboProgAddr.Column(1) Me!txtProgCitySt.Value = Me!cboProgAddr.Column(2) Me!txtLocCitySt.Value = Me!cboProgAddr.Column(2) Me!txtProgZip.Value = Me!cboProgAddr.Column(3) Me!txtLocZip.Value = Me!cboProgAddr.Column(3) End Sub
As you can see it puts each field of data into two separate text boxes. Here's the issue: If I have to go back to the form after the original data entry the following boxes are blank...
txtProgStreet txtProgCitySt txtProgZip
while the following retain the orginal data...
txtLocStreet txtLocCitySt txtLocProgZip
The original cboProgAddr maintains its original data. All six fields above are stored in the same table as text field. I'd like all the boxes to maintain the data from the original input.
I'm totally baffled why this is so. I've attached images of the combo box control functions if that helps.
I have a report that selects and shows records where a specified date field is within the range of 2 dates that the user enters.I created 2 unbound textboxes on the report with a Shortdate format and InputMask 0000-00-00;0;_.When user enter correct dates, then everything works fine: selection is properly done, the right records show up.But I have 2 problems:
1-the input mask is not working: the user can input anything! 2-the 2 unbound textboxes do not show the dates entered by the user.
It seems the value entered bu user does not go straight into the unbound textbox. How do I either intercept the value entered by the user directly into the unbound textbox or via a variable?
I'm developing a form to link a clause to one of a selection of internal documents from drop down boxes (of which there are a lot and hence looking for ways to make it more manageable to find).Now the setup of the internal documents is unfortunately beyond my control (separate SharePoint Libraries, inconsistent fields, you name it they've picked the worst way to do it :P).
I figure the best way to do this is to set up some unbound controls - two drop down (to narrow down location/department), two text boxes (doc code and name) with the idea that it will limit the selection to anything 'like' what is typed in.What I would like is either: How to set the RowSource criteria to only apply if the relevant control is not blank (i.e. if all the boxes are blank, all docs will show; if 'Sales' is selected in department and the user types 'Sales Order Entry' only the Sales Documents relating to order entry will appear)How to add criteria to the RowSource of a dropdown box via VBA (I've created the relevant 'If then ... else' statements but not sure how to add rowsource criteria in VBA)
I have a form that contains a combo box (cboEmployeeName) that pulls data from a query and populates three text boxes (Work Area, Last Name, First Name), This part works fine. Because the text boxes are being populated by the Combo box, they are not bound to the record source tblTrainingSchedule). I need the info that is in the text boxes to populate the respective fields in the record source.
I tested by adding "=tblTrainingSchedule!WorkArea=[cboEmployeeName].Column(3)" (column 3 is the work area) to the "after update" control but it does not populate the data.
This basically gives a count of for a specific month. There are twelve rows of text boxes and two columns. There is a query applied to the report to input the year, as this is a yearly report.
What I want to do is link a chart to each and every text box to show the data in an easy to view format. But I can't seem to figure it out, and I've had no luck on the web .
I have two unbound text boxes and a search button adjacent each that allows me to search for a user via two methods:
1) Payroll ID 2) Surname
They have the following code:
txtPayrollIDSearch
Code: Private Sub txtPayrollIDSearch_AfterUpdate() Dim sWHERE As String sWHERE = "[PayrollID] = " & Me.txtPayrollIDSearch sWHERE = "[PayrollID] = '" & Me.txtPayrollIDSearch & "'"
[code]...
Then minor differences between the above and the Surname search.I have two questions:
1) How do I make the search more friendly by allowing it to find partial matches, i.e., a user has a surname of 'Smith' but I want to search for 'Smi'?
2) How can I display further error messages if there aren't any matches?
I have a form with 1 unbound listbox as drop down list (entypolst), an unbound text box(entypotxt) and a command button. The list box reads items from a table. I want to change a value (text) on listbox, input a text on textbox so pressing the button add a new record in a table (Table1 fields Category,Product) showing in my form as subform (SFTable1) in datasheet view. For that reason a made the following code:
Code: Private Sub AddBtn_Click() Dim ans As Integer Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset Dim ctl As Control
[code]....
I take the error msg for 0 items selected in listbox and exit the sub.
I have a tabbed form from which the user can select a contact's record from a subform on the first tab, click a edit command button, and the unbound text boxes on the top of that tab populate. The user can then click the second tab with employment history which has blank unbound text boxes and another subform which is linked by the contact id to the first tab.
The user can select a record in the second tab, click a command button and the text boxes populate no problem. The problem comes when the user changes the contact on the first tab, and then tries to edit a record on the second tab. Then I get a run-time error '-2147352567 (80020009)' saying the value you entered isn't valid for this field. Why it would work the first time by not the second?
Private Sub Combo1309_AfterUpdate() If Me.Combo1309.Value = "Yes" Then Me.Text1307 = Environ("UserName") Me.Patient_Gender.BackColor = vbYellow ElseIf Me.Combo1309.Value = "No" Then Me.Text1307 = Environ("UserName") Me.Patient_Gender.BackColor = vbRed End If End Sub
I have the above code in an unbound textbox and it functions correctly. Expect, the value Yes/No appears in every record in that textbox,So, if in record 1 the value of that textbox 1309 is Yes in record 2,3,4 the value of that textbox 1309 is set to Yes. How do I make it blank until the user selects the proper choice.
New to Access and learning the hard way. Im sure this is an easy one, but sure would appreciate the help. I am trying to sum a group of cells and display the total, which i have done. But I also want to store this total in my database. So my question is, how do i move my calculated total to my field that has the "record source" bound back to my field in the database? Hope that makes sense. Thanks in advance.
I have a table of records which is is basically temp storage, once I'm done inputing information, an append SQL statement is run to move the data to its permament table, then I use a delete statement to remove the values in the temp table.
Now, I have a column called Result, which stores the values of a radio button group (1, 2, or 3). I have a series of queries which count the number of times 1 or 2 appear (3 in this case, doesn't matter since it represents N/A. 1 = True, 2 = False, 0 = Null).
I'm having trouble getting the result of said query to store in a table. The statement is as follows:
SELECT [qryGetFail]![CountFail]+[qryGetPass]![CountPass] AS Total
FROM qryGetFail, qryGetPass;
This returns the sum of both counts, so I know how many questions were answered either Pass or Fail, hence I know how to score record. Here is my Append SQL statement as it currently works:
INSERT INTO tblAuditResults ( Question, Result, Comment, ACAPS, AuditDate, TeamMember, Auditor ) SELECT tblQuestions.Question, tblQuestions.Result, tblQuestions.Comment, [Forms]![frmAuditCreate]![txtACAPS] AS Expr1, [Forms]![frmAuditCreate]![txtAuditDate] AS Expr2, [Forms]![frmAuditCreate]![cmbTeamMember] AS Expr3, [Forms]![frmAuditCreate]![txtAuditor] AS Expr4
FROM tblQuestions
WHERE (((tblQuestions.Product)="4" Or (tblQuestions.Product)=[Forms]![frmAuditSelect]![txtVarProduct]) AND ((tblQuestions.Function)="3" Or (tblQuestions.Function)=[Forms]![frmAuditSelect]![txtVarFunction]));
This stores everything I need it to. But I cannot for the life of me get the statement to accept a value from a qeury and store it. I have tried adding another expression but it always just prompts for the value instead of pulling the value from the qryGetCalc.
Is there a specific way to have an INSERT statement pull a value off an active query?
I have a form with 15 unbound text boxes (daily temperatures) and what I am trying to do after entering the temperatures into the text boxes the user clicks an add button which will add 15 new records into the temperature table