Make MS Access number field show null not 0 - ms-access

In MS Access in a field, if I click into the field, it places a 0 there as a default. I tried setting the default value to null but that didn't work.
The problem is that if I click in the middle of the field, the cursor is on the left of the 0 (see picture attached). Then I, or more specifically my client, has to click again or arrow over to delete that zero and type the number. Is there a way to have it just have a cursor with no value like a text field?
Tab over and it highlights everything no problem. But when I click into an empty field, I want it to be empty, not 0, so I can type in my number without having to delete anything. Any help on this?
unwanted zero

You can set almost all (number) fields to be NULL by default. You can set that in the table and in the form. If you set it in the table and create a form based on that table then the definition will be the same in the form.
Only very few fields, like indexed fields with no duplicates, don't allow NULL.
And you can set the default value in the table and the form.

Instead of changing to Null in Table change this in the Form. Property sheet select data tab, find default value and set as Null.

Related

How Can I use a ComboBox bound to a null record in a detail section?

In a form, I am displaying rows of data in the detail section.
Around 5% of the rows might actually have a float value in one column that I need to be displayed as a combobox. The column in question results from a left join, so it may have a float, or it may be null with no existing record behind it. I don't want to have 100000 rows added to a table just to show a zero in the combobox on the outside chance that a user actually displays that particular record. Yes, I can add the rows, then delete them later, but that seems stupid. For the life of me, I cannot figure out how to get the combobox to default to a zero for each row, and still be selectable. Basically for each row, show the value if there is one, zero otherwise, and let the user select a new value if they want.
The VBA side is easy. I can totally create the row if a non-zero value is selected, and delete the row if the user changes it to 0. Ideal would be to bind a combobox to NZ(myField,0), or something similar. When I tried that, the combobox was not selectable.
Right now my combobox is selectable, allows the users to change the value, but shows a blank, not zero if the column is null.
The SQL the form is bound to:
SELECT dbo.PersonClasses.ClassID, dbo.ClassDates.ClassDate, dbo.PersonClassHours.ClassHours
FROM dbo.PersonClasses
INNER JOIN dbo.ClassDates ON dbo.PersonClasses.ClassID = dbo.ClassDates.ClassID
LEFT OUTER JOIN dbo.PersonClassHours ON dbo.People.PersonID = dbo.PersonClassHours.PersonID AND dbo.ClassDates.ClassID = dbo.PersonClassHours.ClassID AND dbo.ClassDates.ClassDate = dbo.PersonClassHours.ClassDate
I am looking to represent ClassHours as a Combobox for each record on the form with valid selections being 0,.5,1,1.5,2,2.5. To keep it simple for the users, I want 0 to be preselected. This is how it looks now:
You could set the Format property of the combobox to
#;\0
This will display a zero if the field value is Null. Otherwise the actual value.
Other properties which will also need to be set are the Row Source Type to Value List and Row Source to 0;0.5;1;1.5;2;2.5
Using a function, such as Nz(), in your query to change the value of the field, actually creates a new field, which is read-only.
In your case you need the field to be updateable, so one of your options is to play around with the Format propery, or Conditional Formatting.

MS Access Form Combo Box - Set Default to blank

I have a combo box in a form that uses a query to get the row source (lookup list). I am trying to set the default value to blank but nothing seems to work. It still populates with the first row of the query result. I am thinking it may be because there is no blank value in the list.
Here are the properties I have currently:
Limit to list - No
Allow Value List Edits - Yes
Inherit Value List - No
Show only row source values - No
Default Value ""
Any help is appreciated

how to create a textbox in ssrs for user entry as a parameter

I have a report that has three params. one is dropdown. It created automatically when i supplied
name and value, Then If we select multivalue, it shows multivalue dropdownlist.
But I am not able to create a textbox. That will act as a parameter to be supplied in report.
for that I have created a parameter, set it to allow null and datatype = "text" .
parameter visibility is also visible but as a result I can see a textbox which is a disbled one.
How can this textbox be made to work?
While in the Report Parameter Properties for the text field in question, chose Allow blank value (rather than Allow null value). In the Default Values section of the properties dialog, choose Specify values, Add a blank default value.
Now you will have a working text field that the end user can type into, and you can use that value for searches in your query.
Hope this helps
To allow user to enter the parameter value manually:
Right click on the parameter and select Parameter Properties
On the Available Values tab, select None
Click OK
Now users can manually type in the parameter value.
Click to see screenshot

MS Access - Calculated field with null values

I'm trying to create a field to a database where the value is based on the sum of 2 other fields in the database which contains null values. I am trying to add
NZ([Number1])+NZ([Number2])
to the Expression in "Field Properties" "General" but access won't save it. Any ideas what i'm doing wrong?
If Access does not allow Nz() to be used in a Calculated field then you can use this instead:
IIf(IsNull([Number1]),0,[Number1])+IIf(IsNull([Number2]),0,[Number2])
Edit re: comment
To return Null if both components are Null, try
IIf(IsNull([Number1]) And IsNull([Number2]),Null,IIf(IsNull([Number1]),0,[Number1])+IIf(IsNull([Number2]),0,[Number2]))
Please follow these directions to add a calculated field to your table:
Open the table by double-clicking it in the Navigation Pane.
Scroll horizontally to the rightmost column in the table, and click the Click to Add column heading.
In the list that appears, click Calculated Field, and then click the data type that you want for the result. Access displays the
Expression Builder.
Begin typing the calculation that you want for this field, for example: Nz([Number1]) + Nz([Number2])
Note It is not necessary to precede the expression with an equal
sign (=).
Click OK. Access adds the calculated field, and then highlights the field header so that you can type a field name.
Type a name for the calculated field, and then press ENTER.

Assigning a default value to a Microsoft Access Table Field?

I have a database table in Microsoft Access. I want to assign the default value of one of those fields to another field that happens earlier in the same table.
I tried the value =[Form1].[AssignedByes] with no luck and the same for =[AssignedByes] but with no luck.
Can anyone help?
The field name I'm assigning the value to is [RemainingByes] and the field that assigning the value of is [AssignedByes].
To get around this problem, I create a Query that basically functions as the table. I use it instead of the table when creating other queries, forms, etc.
I'm guessing that you copy [AssignedByes] into [RemainingByes], because [RemainingByes] will start off with the value of [AssignedByes], but you want to be able to change it later.
So, you can set up the Query with a calcualted field called [xRemaningByes]. You would enter the changed values in [RemainingByes]. Then set up a formulat in [xRemainingByes] that returns the value of [RemainingByes] if there is one, and it not, it returns the value of [AssignedByes].
[xRemainingByes]: Iif([IsNull([RemainingByes],[AssignedByes], [RemainingByes].
When you use the Query instead of the Table, you will use [xRemainingByes], which is the Query's calculated field, instead of the Table's field [RemainingByes].
ANOTHER OPTION ---
Create a field in the Table such as [RemainingByesOverride], and that would be where you hard enter the changing data. Then get rid of [RemainingByes] in the table and only have it in the Query as a calculated field.
[xRemainingByes]: Iif([IsNull([RemainingByesOverride],[AssignedByes], [RemainingByesOverride]
A field's default value is applied at the instant a new record is created. So you can't use [AssignedByes] as the default value for [RemainingByes], because [AssignedByes] doesn't have a value yet.
OTOH, if you've assigned a default value property for [AssignedByes], use that same property for [RemainingByes].
If your Access version is 2010, see whether you can use a data macro as a pseudo-trigger to accomplish what you want.
You could also try binding a form to the table. In the after update event of the control bound to [AssignedByes], you can assign a value to another control bound to [RemainingByes]. This could allow you to do what you need in the form, but won't apply for changes made outside the form.