Combobox unable to change the database - ms-access-2007

I am working on Microsoft Access right now. I have a combobox, for example, it has "a", "b", "c", "d", "e" in it. I also have a database fields, with the type of boolean, the fields are "a", "b", "c", "d", "e". If user select "a", the database will be filled with "true", "false", "false", "false", "false". If the user select "b", the database will be filled with "false", "true", "false", "false", "false". Etc. I have tried some coding, but none of that work. Oh, and I don't use a button, since in Access you can click New Record and the data will be saved automatically.
Any idea how could my combobox able to change/fill the database at once? Should I use macro in my program to make it happen?

For others who might use this thread, here's more help from office.com on using the Expression Builder in Access 2007:
http://office.microsoft.com/en-us/access-help/use-the-expression-builder-HA010236949.aspx
And here's a demo:
http://office.microsoft.com/en-us/access-help/demo-use-the-expression-builder-HA010254902.aspx

Related

Array in Custom Query Spotfire

I have a drop-down list with fixed values as i then can adjust the display name. The drop-down list is connected as an input to a "load on demand" data table via a custom query.
I would like to have a list as an input. However, I cannot manage to make it work with multiple items.
In my query i have:
WHERE b.SomeFIELD IN (?parameter)
The parameter is linked to the documentproperty where the value is set as an array. It handles a single value perfectly. Multiple values do not work. I tried:
Value 1, value 2
"value 1", "value 2"
{"value 1", "value 2"}
Any ideas how to make this work? Thanks!
Spotfire passes that "array" as a comma separated string. You need to merely set the on demand setting to the property you created versus trying to edit the SQL in the information link. '
Here's a good tutorial

SQL server report builder show text box only if a field is blank

I have several text boxes that display information that the field cannot display.
Now when there is data in the field, I don't want the textboxes to display their extra information. Is there a visibility expression that makes it so the textboxes are only displayed if the field is blank or 0.00?
Edit:
The text box ("TxtCycleTime13") expressions are: "=IIf((Fields!PartNum.Value Like "16THW-PIF"), "24.0", "0.00")" right now - This makes the text boxes display 24.0 whenever a part number starts with 16THW-PIF
The text box ("TxtCycleTime13") visibility expression are: "=Iif(ReportItems!TxtCycleTime13.Value = "0.00", True, False)" right now. - This makes the text box show ONLY if it has 24.0 (or in other words, if only the part number is 16THW-PIF)
Thanks!
True in the expression specifies Hidden, so if the expression returns true the text box will not show. To invert this you would simply swap the True and False:
=Iif(ReportItems!TxtCycleTime13.Value = "0.00", False, True)
This will only show the textbox if the value is 0.
If you want to check a field instead of the existing textbox, just reference it instead;
=Iif(Fields!CycleTime.Value = "0.00", False, True)

ReportViewer Winforms Error after user deleted row from datagridview

Hi, friends:
I have a vb.net datagridview which datasource is a datatable. When the user deletes a row in datagridview, it is removed from datagridview and from datatable, but when I debug the data from datatable I can see a deletion symbol (see image) in every datatable's cell. The problem is that I use this datatable to fill a ReportDataSource, and when I create the report, the rows below the deleted row doesn't show. An example:
Row1: "Some cool name", " some cool data"
Row2: "Some cool name2", "some cool data2"
Row3: "some cool nama3", "some cool data3"
If user deletes Row2, I can see in datagridview is deleted, and in datatable is deleted too, but this makes an error in the ReportDataSource and data doesn't show properly.
Does any one of you, guys, how can I overcome this?
This must be very simple, there must be a method to refresh de datasource after the deletion.
Thank you very much
The solution was very simple, but not so simple to find out. Let's say your datagridview it's called dgv1. You just have to add this line in the dgv1.UserDeletedRow event
dgv1.DataSource.acceptchanges
And that's it.
Two days spent just for one line. The beauty of Programming ;)

JasperReports Server: Make the input control depends on the other one

I'm using iReport 5.0.0 and JasperReports Server 5.0.0.
And my problem is: I have 2 input control, the one is Boolean Type and the other is text box, and the value of text box depend on the value of Boolean is "true" or "false. When the user select "true", I want to show "Y" in text box. and when he select "false" I want to show "N" in text box too.
Please help me to solve this problem.
Suppose your Input_Controls's IDs are
input_boolean
input_textarea
For Each input-control there will be parameters inside report, namely
$P{input_boolean} and $P{input_textarea}.
To answer your question, In 'Default Value Expression' of
$P{input_textarea} use Ternary Operator expression like this
( $P{input_boolean} ? "Y" : "N")
This will works, like charm.

Winforms Textbox bound to bindingsource with currency format and datagridview not refreshing properly

I'm kinda new to programming with bindingsources and datagridviews (as well as VB .NET) so here's my question/problem.
I'm programming an app in VB 2010 in which users will update data in a SQL 2008 R2 server on the back end (they won't be adding or deleting any records and not all fields will be updated). The form in design mode has a bindingsource, dataset and the various textboxes for the data as well as a datagridview at the bottom of the form.
When the form loads a DataAdapter is loaded and then the dataset is loaded.
(code for the connection omitted, "text_table" is a test table in the SQL server.
frmDataAdapter = New SqlClient.SqlDataAdapter(SQL_Query, frmConnection)
frmConnection.Open()
frmDataAdapter.FillSchema(frmDataSet, SchemaType.Source, "test_table")
frmDataAdapter.Fill(frmDataSet, "test_table")
I bind the BindingSource to the DataSet...
With frmBindingSource
.DataMember = "test_table"
.DataSource = frmDataSet
End With
I then bind the DataGridView on the form to the BindingSource...
frmDataGridView.DataSource = frmBindingSource
Now, in the "test_table" DB table some fields are currency and are not updated buy the user so I bind them as follows...
Me.Total_Amount.DataBindings.Add("Text", frmBindingSource, "Total", True, DataSourceUpdateMode.Never, vbNull, "c")
Now here's the problem...
The users use the DataGridView to move around the records which is working with no problems. Where we run into trouble is that the "Total" field can be "Null" and if the user hits a record with a "Null" in the "Total" field it doesn't blank out in the bound text box for the field, it only changes when there's a "non-Null" value.
So if the user starts out and the first three records have a "Null" in the "Total" field the textbox for that field stays blank. If the fourth record has a value, the text box for the field changes to that value, but if they go back a record the value in the text box for the field doesn't blank but keeps the value and will keep the value until a different "non-Null" value is found.
But, if I remove the formatting during binding like this...
Me.Total_Amount.DataBindings.Add("Text", frmBindingSource, "Total")
everything works perfect.
What am I doing wrong here, what simple thing am I overlooking for forgot and how can I fix it as I would really like to get this formatted correctly on the form.
Found the answer to the problem...
(helps getting some sleep after working several 13 hours days in a row)
Had I read the documentation a little better I would have known to change the "vbNull" in my data binding line...
Me.Total_Amount.DataBindings.Add("Text", frmBindingSource, "Total", True, DataSourceUpdateMode.Never, vbNull, "c")
To just be vbNullString...
Me.Total_Amount.DataBindings.Add("Text", frmBindingSource, "Total", True, DataSourceUpdateMode.Never, vbNullString, "c")
so it will default to "blank" (i.e. vbNullString) when a DBNull is detected, no need to change my SQL query which works.