Access 2016 | Update/Requery a combo box - database

Although a straight forward task, for a reason unknown to me I cannot update/refresh the combo box.
For the sake of simplicity, lets assume I have a table with a primary key, lets call it PK_Number (it is an integer number) and then I have 7 fields (6 field are required to fill in) of various types.
Thus all of the fields belong to a single table.
The PK_Number field I made it a combo box. I did this because when any PK_Number is chosen from the drop down list all the other field should change accordingly
When I try to build an After Update event with the macro builder and choose the Requery command I get the two following pop ups
Now, it is highly unlikely that the database is read only. i made the db and did not make such a thing.
There are couple more questions i want to ask but first i need to overcome this obstacle.
ALthough initialy the row source of combo box belonged to a junction table, i also changed the row source to the master table but without any luck
Can anybody help me out?
Thank you!!

i was able to solve it.
generally speaking the method is to avoid using macros and use VBA instead :-)
besides the fun:
i made a form with all the needed fields. however i also made an additional combo box that will be used to search all records and when the PK changes to change all other related fields
Lets suppose that the combo box name is cbo_PRF_Number. in the after update event i typed the below procedure.
Private Sub cbo_PRF_Number_AfterUpdate()
If Not IsNull(Me.cbo_PRF_Number.Value) Then
Me.txt_PRF_Number.SetFocus
DoCmd.FindRecord Me.cbo_PRF_Number.Value
End If
End Sub
Kindly note that in order for the above to work it is needed to make a bound text box with the same ow source as the combo box.

Related

Make Access Form Update With Buttons

I constructed an Access database for a group of end-users. This database is composed of one table, tblInventory, and several queries for them to edit their data quickly/easily. One of my queries, for example, is:
UPDATE tblInventory SET Amount = Amount-[Enter Amount]
WHERE ((([tblInventory].Equiptment_Name)=[Enter Name]));
This worked great in my opinion, but I have to please the end-user after all. They requested that I make a form and use buttons to update the data in the table for them. I have the form laid out like this:
The Equipment_Name and Amount boxes pull their information from my table, which has categories named that. My Unbound textbox field is where I would like them to be able to enter the number of the given part they would like to take out of inventory. The button should be to run my query above, but instead of prompting for inputs I would like it to use what they entered into the textbox. I've tried many different things and searched many different sites but cannot find what I'm looking for.
P.S Equiptment_Name and Amount are the only 2 datafields in the table besides other fields I have in the table to serve as more lenient ways to search for data when they entered in names. These fields are called things such as Alt_Name1 and have no real relevance to the form.
Thanks in advance for any help given.
There is a couple ways you can do it but the simplest way is:
Build your query as a predefined query(ies)
Build a Macro that disabled warnings then executes your query or queries in the order you wish to execute them.
Go to the form Define the button.
Go to the event tab.
Build an event
Set the OnClick Event to the name of the Macro.
Save and Test.

Programmatically select record in TDBLookupComboBox

I am using a couple ADOQuery's to insert records in a database, one being tied to a DBLookupComboBox. I want the user to be able to insert a record, leave the DBLookupComboBox blank, and programmatically select a value in that combo box for them. I am fairly certain this is simple, I just can't find the exact code needed to do it.
I was hoping that I could just flip through records in the ADOQuery that is filling the combo box and set it on the record I am looking for, but when the code goes to do the Post it throws an exception about not being able to enter null values into the table (as in, the combo box was still sending nothing, instead of the new value)
Does anyone know what I would need to change to get this to work?
The answer was even simpler than I had imagined.
ADOQueryToUpdate->FieldByName("Column_Name")->AsInteger = ADOQueryFillingList->FieldByName("Column_Name")->AsInteger;
Earlier I was trying to cast and use FieldByName()->Value (which is a variant) and this wasn't working. Simply use AsInteger and it will update the ComboBox as you expect.
Sadly, I wish there was a bigger support interest in C++ Builder.

Gather inserted text values from multiple rows in a report

I'm currently struggling with Oracle Apex.
I'm trying to create an application which enables customers to place their order. Therefore I create a report which lists the available products. Furthermore the report contains a column (the SQL query for that is simply '0' as "Quantity") which displays a text box. In this text boy the customer should be able to insert the required quantity.
I've create a screenshot to make it easier to follow me:
After the customer has fill out the form, the "Place Order" button will purchase the wished items then.
My question is now, how is it possible to read out in which text boxes did the user filled in a number and also to which product belongs it!
An easier solution would be to recreate the region but choose Form Region and then Tabular Form Region and then the wizard will help take care of the DML for you. But you need to use specific table columns for this to work.
To answer your question more directly - the input items defined in reports that are posted to the server can be accessed in PL/SQL as a set of "Global Arrays". These are defined as PL/SQL tables in the package apex_application with the names g_f01 through g_f50.
To be sure which of these arrays to use for the quantity text box you can look at the html of the page for the name attribute of the input tag. If it is f01 then you would be able to process the results by accessing each position or element in apex_application.g_f01.
To link the input with the table you would need some sort of key. If you use the wizard to build a Tabular Form all this headache is taken care of for you though.

creating forms with multiple entry fields

I hope to create an entry form that provides multiple entry fields like it appears in microsoft excel where the column headers are up there and several rows below for data input.
i know textboxes have to be placed one at a time and only accept one input per text box and that would take awfully long to just create a form with probably just 10 rows and 10 columns.
how do i go about this.?is there any tool from the toolbox that can help design this form? Id also like to pass entries from the form into the database all in one shot so id appreciate it if the control supports that too...
this is a picture of what id like the form to look like...
Please help out.
Maybe a DataGridView would be appropriate?

SQL 2000, Access Query

I have a SQL database where one of my fields 'Status' has one of 10 entries in it (not from a dropdown list). I let some people have access to the data through an Access database, they can add and modify entries.
My question is, in Access, how can I make it so that the 'Status' field is a drop-down list from which the users can choose from (the 10 entries which are already in the SQL database)? It would be easier for them and also mean that mistakes cannot be made.
Many thanks
Scott
The usual way to do this is to use a combo box on a form with the row source taken from the look-up table and the bound column set to the field (column) of the table to be updated.
In Access you can add lookup information to a column. That will automatically display a dropdown list.
Step 1: Start the lookup wizard:
Step 2: After the wizard, the lookup settings should look like this:
Step 3: When your users open a table, they should see the dropdown box:
In addition to the solution described by Andomar you must not use another table as the source for your lookup. You can also provide the lookup-values in a list, which is hardcoded in the table-definition. This is fine for simple scenarios where the lookup is something that is not likely to be changed.
Several issues here:
table datasheets are not suitable user interface for users.
you can create a saved QueryDef and if you view the properties of a field, the second tab is just like the second tab in table design, and allows you to use a combo box as your display type in your query. I would generally recommend against this, as, like table datasheets, a QueryDef is not a proper UI element, and if you use the saved query in other queries, you can run into the same problems that cause lookups in table fields to be such as bad idea.
you're building a UI, so use the tools that Access provides you for building a UI. That means a form. Your form's recordsource would have the bare data, and you'd create a combo box on your form that is bound to the field in the table behind your form, and displays the values from the lookup tables. There's a wizard to step you through this. If you like the look of datasheets so much (column sizing, sorting, show/hiding are all features that are nice in datasheets), you can set your form to display as a datasheet.
My advice is that for building a user interface, use the tools Access provides for creating user interface. In my opinion, a dropdown list belongs in a form, and nowhere else. While I occasionally might add one to a query for quick-and-dirty editing, I would never do that in objects that users are going to use.

Resources