Forms :: Subform Blank When A Field Is Null
Feb 21, 2014
I have a form with a subform. The subform is used to report a sales total, for today and for the month. When there are no sales today (a null result in one of the fields) the entire subform goes blank.
How can I make it report a zero in the field instead of blanking the entire subform?
View Replies
ADVERTISEMENT
Sep 15, 2015
I am trying to show a certain subform based on whether or not a field is blank or null. This database is not owned by me--it's what we use to run queries and reports on the data on a centralized server for the library. It's not even in the same city--so changing the tables is not an option for me.
So, I have a subform (subform1) that is linked to the main form based on 2 fields (BibID and Item_Enum). The trouble is that the second field (Item_Enum) is sometimes blank, so the subform will not display. So I created another subform (subform2), which is a duplicate of the first one, but this time only linked on the first field (BibID). So, if that second field (Item_Enum) is blank, I want subform2 to display and subform1 to be hidden. If the second field (Item_Enum) is not blank, I want subform1 to display, and subform2 to be hidden.
I've tried putting the VBA code on different events for the form, but I can't get it to work consistently.
There are two problems, one of which I think I have fixed--but I would prefer a better solution. The VBA code doesn't run unless the form is newly loaded. I've tried placing the VBA code on different form events, but nothing works. I want the code to activate whenever a new record is displayed. The work around is that the form IS newly loaded every time the user scans a barcode for a new book. That works now, but if I need to change the way the user looks up new records, this might not work anymore.
The second problem is that the VBA code doesn't display subform1 when Item_Enum is blank. It doesn't display subform2 either, but that's the desired result.
Private Sub Form_Load()
If Me.ITEM_ENUM = "*" Then
Me.subform2.Visible = False
Me.subform1.Visible = True
Else
Me.subform2.Visible = True
Me.subform1.Visible = False
End If
End Sub
I've tried changing the condition to Me.Item_Enum = null, and changing the false/true results accordingly, but that didn't work either. In that case, only subform2 is visible, whether it should be or not.
View 2 Replies
View Related
Aug 4, 2015
The unbound Parent form has a listbox (SQL Server) , the selection updates the SubForm with a primary key ID. The Subform is a ReadOnly view from an Oracle Linked table. It populates with a Select * From Oracleview where ID = listboxID The code is at the link shown below update: The subform uses textboxes linked to the read-only record.
The main form can populate, no problem. However the SubForm data source is either populated OR is Null.
If it is Null, the subform stays blank. Two Objectives:
1. Set a boolean variable flag in the parent (main form) that subform record exist or that it is null. e.g. Parent obtain recordset count property from Sub form
2. Display the subform with blanks.
[URL]
View 3 Replies
View Related
May 15, 2013
All. Using access 2010. I have a query that returns 92 records. When I put in the criteria for one field to leave out records with “approved” which totals to 9 records, the query only returns 10 records. It is not returning the records that are blank(not null) for that field. I want those records. Why is this happening and how can I get the blanks for this query?
View 2 Replies
View Related
Nov 10, 2013
I have a subform that stays in data sheet view for entry, the form this sits on is launched by a macro. This macro on the main form launches the form and adds in the linking numbers by a setvalue. The main form has the linked number on it and this number is then linked by master and child to the subform. The problem comes in when you start adding in data. The line of data is filled by using combo boxes and some text fields and ends with a time/date stamp Now(). The problem is, even if you dont fill the entire line if a user refreshes or closes the form it adds a blank entry with the linking number but all fields blank.
View 1 Replies
View Related
Sep 7, 2013
I have a [Order Central table] that compiles products from four different categories that employees can order from.
Employees using the database will select from four categories on buttons which opens up the order form EX: [Category 1 form].
They enter their order info on [Category 1 form] into a subform sourced from [Category 1 Table] called [Category 1 subform].
Is there a way that they could select the "Category 1" button, which would run a macro opening [Category 1 form] with the [Category 1 subform] having a where condition of 1=0 (or just so that the subform appears blank)?
View 7 Replies
View Related
Apr 4, 2013
On a form I have 2 list boxes and a subform in a cascading arrangement. When the form is opened the first list box is populated with data from a query. When an item is selected in List Box 1 then entries appear in List Box 2 from another query. When an entry in List Box 2 is selected then entries appear in the Subform from a third query. It's all working fine except for this:- if a new selection is made in List Box 1 then I want all entries in the Subform to be cleared until something is selected in List Box 2, but I can't see how to do it.
I've tried setting the Subform's recordsource to null, to " " and to "" but none of these work properly. They either give an error or leave a single entry in the subform with #Name? in every text box.
It does work if I use a List box instead of a subform but that's not what I want here.
View 2 Replies
View Related
May 15, 2014
I have a subform with a textbox in the footer to count[id]. then on my main form i have another textbox that has a control source of =[subform].[form]![subformfootercontrol].
However when the subform updates the main form text is blank. typically i see a ?#Name or#Error if the control is pointing to the wrong place, but i have never see it stay blank.
View 3 Replies
View Related
Mar 15, 2007
Hi. This might sound stupid but it is a real issue for us.
In our datafile some fields' values were updated to " " . A government entity wants the value to be blank, instead.
How do I change this?:confused:
Likewise, there are some instances where the reverse is true.
How do I change those?
Russ
View 6 Replies
View Related
Nov 16, 2007
I think the title pretty much sums it up....
I have a query where data is first sorted by user input; first field's criteria: [fieldname], then by another field's criteria: Is Null.
I know there are records containing null values in the second field, as I have run a select query with the criteria: Like "*", to make sure they are null, and not zero-length-strings.
The query is refusing to return any results...
Any ideas?
View 10 Replies
View Related
Jun 8, 2005
I'm working on a db logging replies to a questionnaire. Judging by the responses I am receiving it appears that some sections are not completed at all. I need to be able to include these blank responses when it comes to analysis.
My design splits the questionnaire into sections, each section has a data entry form with its own underlying table. Each table has a primary key (autonumber field) which relates to each organisation that has replied.
If an organisation has failed to complete a section, I still need to create a new record in that section(table), triggering the autonumber field, hence referring back to the organisation.
I know I haven't explained this very well, but if anyone can make sense of what I'm saying and can give me any suggestions on how to make this happen, I would be most grateful.
In anticipation of your replies
Ride
View 4 Replies
View Related
Jun 18, 2015
In a query, how do I return a blank or null.
IIf([Field1]=[Field2],NULL,[Field3]
They are all numerical values that I need to format into percentages however Field3 could contain zero so I can't replace Null with zero. I simply want to return nothing if Field1 is equal to Field2.
View 3 Replies
View Related
May 11, 2014
I would Like to save the data to our Table
[InvoiceTotal] - [InvoicePersonal] "if Invoice Personal contains a value" = [InvoiceShareLoan]
If "InvoicePersonal" does not contain a value, no calculation will be made
View 2 Replies
View Related
Mar 11, 2013
I have a form in access 2010 that prints a document rougly 500 pages in length. I want to know if there is a way to tell the form not to print a particular page if one of the fields on the page returns the word "suspended" and or the field is blank. The page has other data on it, as do they all, but if this particular field comes back null or "suspended" I would rather it just did not print that particular page in its entirety.
View 5 Replies
View Related
Apr 25, 2014
Normally I don't have any troubles sending an e-mail; however, this time I want to include a text field (cc copy) that is sometimes blank. The e-mail will not send if the field is blank. So, I tried using an If Then statement but that doesn't work within the SendObject command.
Here's the code I tried ...
DoCmd.SendObject acSendNoObject, , acFormatRTF, Me.POC1EMail, If Not IsNull([Me.POC2EMail]) Then Me.POC2EMail, , "FOUO: Assistance Request", "Text here", True
View 1 Replies
View Related
Oct 29, 2013
I am attempting to use VBA code to make the label in my report hidden if the text box is blank. I am very new to coding, and am not sure how I would express this in code. I have been looking at a few examples of how to get this done, but it doesn't seem to work. Where to insert the code. Attached is the image of the properties for my label and text box that I want hidden if text field is blank. I al just lost trying to figure this out.
View 7 Replies
View Related
Feb 27, 2014
Ok i have a customer form with a button that opens a job form the customer and job tables are linked with a customerid field.
When the job form opens the records are filtered to show the ones matching the customerid displayed on the customer form.
Problem is when i then go to add a new record on the job form it leaves the customer id field blank instead of knowing to pass on the customer id ?
View 2 Replies
View Related
May 11, 2014
How to have a message appear if the "Symbol_Stock" field is blank.
View 14 Replies
View Related
Jun 26, 2014
I have an address box that I would like to auto populate with a double click event. Basically, if the location address is the same as the main company address, and there isn't any data already in the location field, then I would like the user to be able to just double click the location address and the field gets automatically populated with the main company address.
Private Sub Address_DblClick(Cancel As Integer)
If IsNull(Me.Address) Then
Me!Address = Me.CompanyName.Column(1)
End If
So this works fine if the main company address actually has an address in it. But if it doesn't then double clicking the location address produces a run time error 3315 for trying to populate a null value.
View 4 Replies
View Related
Sep 4, 2013
I have a form that runs a search query.
I have an error trap set on a date field.
If (DataErr = 2113) Then
Select Case Screen.ActiveControl.Name
Case "DA_Start"
MsgBox "invalid date", vbExclamation
Me.DA_Start. = Null
End Select
Response = acDataErrContinue
End If
End Sub
This will pop up the error message, but will trigger the debuger when gettin to "Me.DA_Start = Null"
View 12 Replies
View Related
Sep 4, 2014
I have a form called frm002_PAF_MonitoringMAIN and on this form I have a subform called frm002_PAF_Monitoring. The subform has a button to another form for contact details called Contact_Details. The Contact_Details form opens with the details of the person who I have selected on frm002_PAF_Monitoring. There are some fields on frm002_PAF_Monitoring that I would like to be populated on Contact_Details when opened, like FirstName and LastName. How can I do it?I have tried on afterupdate event on Contact_Details below but those don't work:
Me!FirstName=[Forms]![frm002_PAF_Monitoring]![FirstName]
Me!FirstName=[Forms]![frm002_PAF_MonitoringMAIN]![frm002_PAF_Monitoring]![FirstName]
Me![FirstName].Value=[Forms]![frm002_PAF_Monitoring]![FirstName]
Me![FirstName].Value=[Forms]![frm002_PAF_MonitoringMAIN]![frm002_PAF_Monitoring]![FirstName]
View 11 Replies
View Related
Jun 19, 2013
I have a form, combo box selection, when i make a selection, all the info is good on all my tabs, which holds the subform.My issue is, on one of the subform, it's a data entry form, where I want it to be on a new record page. instead it list all records. I want my users to see a blank page, but have one field populated. is this possible?
1) blank data entry page, but with a populated field?When a CU Name is selected,I want the (Enter Note) tab to go to a data entry or last page or new page.I have tried putting it to data entry form, but the CU Number will not populate.
View 1 Replies
View Related
Aug 27, 2014
I have a SQL Server 2005 backend table with a varchar(1) field which allows nulls. The field is populated from a combo box in Access 2012. The field can be set to 1,2 or 3 via the combo box or left blank in which case its value will be null. Sometimes I need to reset this field to null. How can I do this via a combo box? I know I could just set this to an empty string but this would mean re-writing a load of queries which a looking for a number or null.
Something like 1;"First";2;"Second";3;"Third";Null;"Blank"
View 7 Replies
View Related
May 22, 2015
I have a query which returns, among other things, a number of boolean fields. In some cases, there will be a genuine True or False value in each of these fields; in others, it can and should be Null (e.g. as a result of a 'failed' LEFT JOIN of some description, where there is no associated record in the joined table which fulfills the criteria)
So something like this :
Code:
SELECT [tblTable2].[fldBooleanField]....
FROM [tblTable1]
LEFT JOIN [tblTable2]
ON [tblTable1].[SomeID] = [tblTable2].[SomeID]
However, I will be writing the result of the query to a text file and here's the problem. I want to show a numeric value for a genuine True / False (i.e. -1 and 0 respectively using the standard boolean conversions in Access) and a blank for any Null values.
So I tried this :
Code:
SELECT CInt([tblTable2].[fldBooleanField]) AS fldBooleanField....
FROM [tblTable1]
LEFT JOIN [tblTable2]
ON [tblTable1].[SomeID] = [tblTable2].[SomeID]
However, currently when I look at the exported recordset in Notepad, I am getting 0's for both False and Null values (and -1 for True)
How I can adapt my query to keep Nulls...null? And convert the genuinely present boolean values to integer form?
Only thing I can think of is to use (untested) :
Code:
IIf([tblTable2].[fldBooleanField] Is Null, Null, CInt([tblTable2].[fldBooleanField]))
But there's a number of boolean fields in there, all requiring the same treatment.
View 14 Replies
View Related
May 21, 2014
I think I have just finished designing my database and I tried to test it and I couldn't enter any new records as it says "Can't enter data into blank field on "one" side of outer join" whenever I try and enter info and I don't know much SQL to work out what has happened. It probably causes this too but I also cannot select check boxes.
The form where I try and enter the info is called Crisis_support_workers v3. I have attached my database so you can look at what I have done.
View 1 Replies
View Related
Sep 22, 2014
I have a form called PAF_Assignment and on this form there are many textboxes for editing. After all fields are entered, the user clicks on a button and this button populates the PAF_Issued_Date field with the actual date.
Then I want to disable (enable=False) all fields on this form once there is a date on PAF_Issued_Date as I don't want any user to make any changes after submitting it, although the user would still be able to read the information submitted.
I have tried the following...
PAF_Assignment Form AfterUpdate Event
If Me.PAF_Issued_Date=Not null Then
Me.FieldName1.Enabled=False
Me.FieldName2.Enabled=False
Me.FieldName3.Enabled=False
[Code] ......
However this is not working, there is no error message or anything but the fields remain enabled with the date...
View 3 Replies
View Related