Access Update a table row based on a combo box selection - forms

I have a table I would like to edit based on a combo box selection in a form.
For example, let's say I have a table that has the following fields:
Computer Name | Location | Number of Updates installed | etc.
What I have done is created a form based on this table. It includes a combo box to select the computer name that's being updated. What I would like to do is fill out the rows based on the computer selected in the combo box.
What's the best way to do this?

Related

create a select box in which data is populated from selecting another select box and it is editable

I have created two select box. in both, fetching data from database. By selecting first select box the second select box gets auto populated. What I want to do is that this second select box should be editable that is the user can type input also. What I have done now is that used datalist for second select box which is doing the thing, but I want to show the auto populated data as selected option in datalist

FileMaker: Allow the user to filter the table and then revert back to showing all records

I've just started using FileMaker Pro. I have created a spreadsheet in Excel which I'm basically trying to recreate in FileMaker.
I have my table (or, Portal) set up with data. Above the table I have 3 drop down fields, which pull their values from the table below. Based off of the value of the drop down fields, I want a GO button that will filer all of the table items to match what is in the 3 drop downs.
Image the table contains Car, Colour, Year. If the user selects Mercedes, Red, 1980 from the 3 drop down fields, I want the table to only show results that match those fields.
Ideally I'd like a button to trigger this action, and another button that resets it so it shows all results.
I can see that you can filter the table when you double click it, but this seems to set it to permanently filter. I want a button to do it basically.
Would appreciate the help! Thanks

In MS-Access, how to display the old foreign key in a combo box when the foreign key no longer exists?

I have a combobox with two columns. The first column is hidden. The second is not hidden. The first column is the bound column. The second is the display text.
ColumnCount = 1
ColumnWidths = 0";1"
RowSource = "a select statement"
BoundColumn = 1
For example:
SKU | Description
"teapot" | "Pretty Teapots"
"saucer" | "Excellent Saucers"
"tallcup" | "Tall Cups"
The user sees the second column in the combo box. Everything works. If the user chooses "Tall Cups", then "tallcup" is stored in the underlying table.
Later....
The value "tallcup" is removed from the list on purpose. What I now want is for the user to see "tallcup" in the Combo Box for those records where it was originally set. But for new records, "tallcup" is not an option.
What it currently shows is blank. It's as if nothing was ever selected.
Do I need to do something with the format property?
Here are some related links that I found around the internet, but they didn't help me much:
http://www.tutcity.com/access/display-the-corresponding-unbound-column-entry-of-a-combobox.79599.html
https://www.google.com/search?q=ms-access+2+column+show+first+combobox+missing+show+anyway&rls=com.microsoft%3Aen-us%3AIE-SearchBox&oe=&gws_rd=ssl&oq=&gs_l=
http://www.experts-exchange.com/Database/MS_Access/A_5890-Adding-the-option-all-to-a-ComboBox.html
Add a third coloumn with an Active flag. Set it to False for tallcup and add an beforeupdate event setting Cancel to Not Active and pop a message if so.

How to populate the value of a Text Box based on the value in a Combo Box in MS Access 2007?

I have a combo box which is of a lookup type, i.e., I've selected the source to be a column from a table and am storing the selected value in another table. The table which I am looking up has another column and I need the value in this column to be displayed in a text box and each time I change the value in the combo box, I need the corresponding value to be displayed in the text box. How can I do this? What I have done so far is to write a Select query that selects the appropriate column based on the combo box's value. Is there a more decent way of doing this? Please help me!
Make the source of the combo box to your 2 fields e.g. SELECT id, name FROM Customers
Make sure you set the Column Count property of the combo to 2, accordingly.
Then make you unbound text box source equal to =MyCombo.Column(1) (from memory, this Column is zero based).
That's it, zero code required.
It's nicer to use an event of the combo box e.g. onChange, so when a selection is made the event sets the value of the text box.
me!txtTextBox1 = me!cboComboBox1.column(1)
That way it will work everytime.
You could also use a button with onClick etc. but the choice is yours (and as mentioned in the previous post, alter the column number based on its row source with 0 being the first.
After reading the question and answers I tried the following, and it seems to work well (so far):
In order to display more than one column of a combobox selection, I have resorted to the following:
Place a textbox over the combobox,
Size it by sampling other fields, so that it covers the text frame of the combobox.
I have purposely have left a small space to the right of the NEW textbox to indicate that it
Is NOT part of the combobox.
In the Control Source for the textbox enter the expression below:
=[DefaultAcct].[Column](1) & " " & [DefaultAcct].[Column](2)
Then, in the ‘onchange’ event of the combobox, set focus to the textbox.
Private Sub DefaultAcct_Change()
txtConcatenate1.SetFocus
End Sub

VFP - Control report from form

iam using VFP 9.0...Iam making an invoice report, what i want to know is how to change the contents of the report by changing lets say a combo box in a form. or be able to use select and where clause in the report...any help would be appreciated :)
EDITED FOR CLARIFICATION (per comments instead of direct add into question)
+-----------------+ +-------------------------+
| Contract Form | | Invoice Form |
| | | |
| | | radioCustomer |
| btnInvoiceForm -------> | comboCustomersList |
+-----------------+ | radioContract |
| comboContractsList |
| |
| btnPreviewReport |
+-------------------------+
If I click on the Preview Invoice button, show all records from contract table where customer id (FK) is = to the id picked from the combo box.
If I picked contract from the radio buttons, the contract combo box would work, showing a list of contract id(s), running the report then would show you the record from the contract table where contract id = the id picked from the combo box...
I've edited the message to hopefully better understand your layout of the form(s) with respective radio button combobox controls respectively enabled/disabled. I think you'll need to draw up two distinct reports no matter what showing respective content, then call each one based on the radio button setting... Such as in the "btnPreviewReport" object CLICK event... I've roughed-in on the sample...
if not empty( Thisform.radioControl.radioCustomer.Value )
*/ Customer radio button was selected
xCustomerID = comboCustomersList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleCustomerData
*/ Run the report
report form YourCustomerReport preview
else
*/ Contract radio button was selected
*/ Customer radio button was selected
xContractID = comboContractsList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleContractData
*/ Run the report
report form YourContractReport preview
endif
Again, I tried the form as best from your description.
EDIT -- second comment clarification...
The nice thing about reports in VFP is they do not pre-require any hard DBF() in the data environment. However, it would be good to have your data fields set to an Alias.Field reference you are EXPECTING to have. So, if your querying of the data for the Customer report should always have the same expected alias result...
ex:
// pre-close in case the alias we want was already left open previously
use in select( "C_CustomerResults" )
select c1.*;
from YourCustomerTable c1;
where c1.ID = SomeChosenID;
into cursor C_CustomerResults readwrite
Then, in your report, have all your fields to something like
C_CustomerResults.FirstName
C_CustomerResults.LastName
C_CustomerResults.OtherField
This example uses an otherwise long alias name but just for clarification of handling.
I would do a similar for your "contract" results alias. As long as that alias is in use, the report will run against whatever is the current table in use. Nothing fancy, no other prep, no data environment settings needed in the report...
By pre-querying a sample of the data you would have in the report can help you in "roughing" the layout of your report. Then, finish your form to run the query and show the report and you're done.
EDIT -- revised comment follow-up again
Yes... for your customer invoice with multiple lines, same thing... however your report has a header band for things you want to only show once at the top of the page, and a detail band where you would want to show content for your "each line item" of the invoice, and a report footer to show any totals. Depending on complexity, you can add additional "Data Groups" in the report, but start with this now. It sounds like you need to get your feet wet with something working first before you expand on it.
If VFP is your development platform, another website that has dedicated experts in VFP all the time is at www.UniversalThread.com. They also support other forums, but in VFP, they'll get 100+ questions thrown at it a day...