Okay so I have a column called 'totalincome' on TblCashflow. There are 60 records of TotalIncome (represents 5 years or 60 months) per asset that I have on another table, TblLoanGeneral.
What I need to return is the LAST value from totalincome that is not null. For example, we may only have entries in the 60 records that go to row #35, or 50 or whatever. When I use the Last criteria it gives me the 60th record (in example would give me a 0), and when I use the Max criteria, it gives me the largest income value regardless of location(would be 50,000 in example). What I need is really where the "last" income amt is >1 (20) however, when you set last, it only considers row 60.In the example below I would want 20 to be returned.
I have 1 query that connects 4 of my tables through a tracking number. I am trying to make it so the value (DStatus) from DTable will populate where a (DStatus) is provided, but where there is no (DStatus) the column is filled in with a (SStatus) from STable. There is always a SStatus for each tracking number, but not always a DStatus, where there is a DStatus, it is more accurate.
Can I do this all in 1 query, whether I have to make a new column within my query for this to work, whether I need to have my query output into a table first.
Is there something I could type into the Criteria field of my query.
I have tried using Nz([DStatus],[SStatus]), an Iif Statement, the IsNull function, etc with no avail.
This is the function i'm using for summing a listbox column:
Function TonSum() As Variant Dim I As Integer, J As Integer, ctl As Control Set ctl = Me.lstDrivera2 J = ctl.ListCount - 1
[code]...
The problem i have is if one the records in the listbox doesn't have a value (is null) then Access gives me a 'Type Mismatch' error. How to treat the null value so it excludes it from the sum?
I've been trying to populate a field in a form with information, but only if the field is blank.
What I am trying to do is this.
I have a continuous form displaying all of our principals, however when our principals are on leave I want to populate the field with the "acting principal". I have set it up so the field grabs the acting principal first but it is blank for several schools. For these schools where there there is no "acting principal" I want it to grab the substantive principal automatically and populate the field.
I have tried Is Null, Is Not Null, NZ, IF, Where and Then statements but to no avail.
This one is driving me nuts. After doing quite a bit of research, I cannot find the answer that I need, so I am posting...
For a new record on frm1 I am trying to make the label (lblTest) for a text box named txtTest a certain color if a value has not been filled in. For some reason, I cannot get the code to work and I am guessing it is due to my lack of understanding of our good old friend NULL. Here is what in both the after update event for txtTest and the on current event for the form...
If Me.txtTest = Null Then Me.lblTest.ForeColor = 255 Me.lblTest.FontBold = True Else Me.lblTest.ForeColor = 0 Me.lblTest.FontBold = False End If
Why isn't the field red when I create a new record? Why is it that if I fill something into the field, then delete it, that it doesn't get bolded in red?
I'm hoping someone can help a noob with a simple problem:) I did a search but couldn't find the answer.
When a user clears a record and leaves it Null I would like to prompt them whether they would like to delete the record before the access error message about invalid use of Null comes up. If they don't want to delete the record then the code should undo the change. The problem I have is I can't seem to run my code without the access error coming up. I can't see where I can trap the error (err.Number 3398).
For example, this doesn't work:
Private Sub txtSalesItem_BeforeUpdate(Cancel As Integer) On Error GoTo Err_txtSalesItem_BeforeUpdate
Dim response as Integer
If IsNull(Me.txtSalesItem) Then response = MsgBox("Do you want to delete this category?", vbExclamation + vbYesNo, "Delete Sales Item?")
If response = 6 Then Runcommand acCmdDelete
else RunCommand acCmdUndo endif
End If . . .
I know I can put in a validation rule, but I would like to go a bit further. Does anyone have any suggestions?
The two records that I get the proplem on are not included here, but somehow they have been updated. I traced the access code, but I could see no reference to them that they were used for the update in either the form or any modules called.
Somehow up to a few weeks ago those two columns were updated.
Tracing the code and using the immediate window the user_name variable stores the login name corectly.
What I need to accomplish is an alert if a query finds any records. In other words, When the main page is loaded a query will run in the background. This query is looking for any records that need to amended within the next 30 days. What i would like to do is if the query finds any records that need amending an alert "form" or conditional formatting in a field with turn it red as an indicator that attention is needed.
My problem is how do i write a code to see if the record set from the query is greater than null???
New to this, but found some helpful tips/code already that I've integrated into my project.
You may well be familar the issue tracker database available for download from Office Online, well I'm using this for a little project I'm running.
What I want to do is tie up a few snippets as follows:
1-On my form I have a button called "Close" 2-When I click the Close button I want to check two fields, "closure" and "fix" and ensure that they have content i.e. not null 3-If they have content then I want to alter the "Status" field of the displayed record from Open or Suspended to closed (these are the three options for this field) 4-If the "closure" and/or "fix" fields are empty then I want a msgbox to pop up promting the user to fill out the relevent field/s, otherwise mark the record as closed
So;
Click close button, check contents of two fields, pop up a message if either or both empty, enter details in empty field/s, click button again and as both fields are now complete,mark the records status field as closed.
I've got so far but can't quite tie it all together, is what I'm asking possible? What do you need from me to help answer the question?
Nutshell: My user DB has one menu with 4 tabs (2 for adding records, and 2 for searching/editing records). Since the form opens up in the acFormAdd mode, Access already creates a new record (blank) before they type anything. It is resulting in blank false new records that are getting added to the table and they are getting annoying. My audit table is full of "user X created new record at this time" when it's just a blank record.
There must be a way to prevent this using VBA, but I cannot find it.
I've seen ways to disable "add new record" buttons and such, but nothing that disables Access from being smarter than me and creating a new record before I decide to.
I've designed a DB in access which has a BackEnd and 2 FrontEnds (one person insert all the records and the others just keep inserting infos till the process is finished.The DB has 12 tables and we used it for about 6 months without having any trouble but recently (2 weeks ago) i've add 3 new tables and then related them to one table that already exist.
The DB was running smoothly for a week after the changes but last monday (09/15) the "Record is deleted" appeared. I've compacted and repaired an the following errors descriptions appeared:
ErrorCode: -1017 ErrorDescription: Record is deleted. ErrorTable: tblFatura
ErrorCode: -1053 ErrorDescription: Index or primary key cannot contain a Null value. ErrorTable: tblFatura
ErrorCode: -1630 ErrorDescription: You cannot add or change a record because a related record is required in table 'TblExpense'. ErrorTable: tblFatura
I've restored the file via IT using the Backup2 days before the error occurred but after 30 minutes the same error appeared! I dont know if it is related to the new tables that i have add or no?
I am building a database to capture monthly statistics on a number of items. I want to ensure that users don't enter statistics for the same item for the same reporting period. I found the following instruction, but can't make it work:
It suggests that I create multiple primary keys in the table
When I do it, it comes back with an error: Index or primary key cannot contain a null value.
Hi All, What is the easist way to select a column's value in a subform. After the record is selected I would like to write a value ("0") into this column by way of a button click..
I want to make a calculated column that adds 1 for every new record that isn't marked as being 'deleted' and will possibly subtract one if a record is marked as deleted. I'm not sure where to start other than calculated column.
Creating a query in Design View, how does one create a query in the "Condition" field that tells the Access to return the record set where the contents of one column is greater than the other?
There are obviously many more columns than those listed above in the table, but these are the two I want to compare. Also the two columns contain numbers.
In SQL I would write it like this:
Select * FROM SURVEY_RAW_DATA WHERE TOTAL_EXP > TOTAL NX;
I have a form that has a combo box (box1), Its row source is from a table (table1) than the forms record source (query1). The data box1 sources is from column1 in table1.
I then have a text box (box2). I need it so when i select a record in box1 (from column1) that it displays the corresponding data in that same record (and table) but from column2
Example:
A table has a column with equations and another column with the answer.
I select "1+1" in the combo box Then in the text box it displays "2"
I'm tracking the holiday entitlement of a team of people. I use a query to work out how much unbooked holiday they have to take.
My problem is where I'm scheduling next year my query returns the names of those who have booked a holiday and their remaining entitelement. That's as it should be. However if someone hasn't yet booked any holidays then it simply doesn't display their record. I would like it to treat that record as zero and show the remaining entitlement as a full years entitlement.
Here's the SQL SELECT Employees.Trainer_Name, Sum([2015 Holiday].[2015 Days]) AS [SumOf2015 Days], Employees.Holiday_Days, [Employees]![Holiday_Days]-[SumOf2015 Days] AS 2015 FROM [2015 Holiday] INNER JOIN Employees ON [2015 Holiday].Trainer_Name = Employees.Trainer_Name GROUP BY Employees.Trainer_Name, Employees.Holiday_Days;
The problem here is that the Sum of 2015 holiday is Null