Add computed column to access database via VBA - vba

I have an Access table in which I would like to add a computed column "Test" with a formula like IIF(Not(isNull([field])),DLookup(...),[field2]). When new data is added to the table, "Test" would be computed automatically.
I managed to do it with a request but I would like to have the result directly in the table.
What is the best way to do it ? VBA ?
Thanks,

Related

Adding a dynamic column in copy activity of azure data factory

I am using Data flow in my Azure Data factory pipeline in order to copy data from one cosmos db collection to another cosmos db collection. I am using cosmos SQL Api as the source and sink datasets.
Problem is when copying the documents from one collection to other,I would like to add an additional column whose value will be same as one of the existing key in json. I am trying with Additional column thing in Source settings but i am not able to figure out how can I add an existing column value in there. anyone with any help on this_
In case of copy activity, you can assign the existing column value to new column under Additional column by specifying value as $$COLUMN and add the column name to be assigned.
If you are adding new column in data flow, you can achieve this using derived column

Update custom fields in an VBAP append structure via VA02

I have the following requirement. I need to save some parameters in the table VBAP. I've created additional fields in an append structure for that. Now, when a sales document is being saved, the parameters have to be updated as well.
For this I've been using USEREXIT_SAVE_DOCUMENT in the program SAPMV45A. There I loop over the table XVBAP where I set the fields.
This works as expected for existing positions. When a new position is being added the fields won't be updated and are empty.
What am I missing here? Do I have to use a different user exit for new positions?
Thanks in advance.
you can use "USEREXIT_MOVE_FIELD_TO_VBAP" in MV45AFZZ

MS Access - setup combobox to allow input of data not in the tables

I need help with MS Access 2010.
One of the client's requirement is they need to be able to input new data and also be able to have a drop down list of the data existing in the table for selecting using a combobox. Im very new to MS Access, only managed to work around it using online tutorials. Im not too clued up with VBA coding. I have tried swicthng around the properties components, still not working.
please assist.
thanks
That's what I have done. Wanted to allow free entry but still assist the user if value already exists.
One option is to use the data table as source for the combobox RowSource. Set the combobox LimitToList property to No. Then the combobox RowSource would be like:
SELECT DISTINCT fieldname FROM tablename WHERE NOT fieldname IS NULL ORDER BY fieldname;
However, if you want a new value to be available for next record for a continuous or datasheet form, the record must be committed to table and then requery the combobox. Record is committed when: 1. close table/query/form; or 2. move to another record; or 3. run code to save. So code in the form Current event like:
Me.comboboxname.Requery
Another option is to have lookup table for the combobox RowSource and set the comobobox LimitToList property to Yes. Then code in the combobox NotInList event to allow new value input by user to be saved to lookup table. Review: https://msdn.microsoft.com/en-us/library/office/ff845736.aspx
Apologies for not being clear... i have however managed to fix this by pointing the row source to a table. This has allowed me to be able to do a selection on existing entries on the table and also "allow" adding new data using the same combobox.
thanks.

How can I import data using SSIS from an excel with dynamic columns?

First of all I am sorry for asking a question like this. I am beginner in SSIS. I just created some samples and I am trying to change one of the tool I developed in .net to SSIS. My scenario is I have a table with custom properties to my documents. These properties are created by the user as per their reqirements. (The general properties will be stored in a seperate table. The current problem is the custom properties.)
For example.
When user add a custom property like region, My service code will add a column in the custom property table. In this way the table will grow. How can I migrate data from excel to this table. In ssis I need to map the columns. Is there any way to create this logic with dynamic number of columns.
Sample data
Name projectNo region phone email
Name projectNo location contactno interests skill1 skill2 skill3
Here Name and projectNo are to be stored in a table. This is a direct logic. But my problem is the table stores the remaining columns is different.
it is like
ObjectId Prop1 prop2 prop3 prop4
Each prop field will be saved in a master table.
PropId PropName datatype length
Looking forward to your reply.
I see 2 options for you:
Create another sheet in your Excel (maybe not visible): With a macro in VBA, you can transpose your current data into a new table. (This table could have always the same structure)
How do i loop an excel 2010 table by using his name & column reference?
Use BIML to create SSIS packages on the fly (based on your datasource)
https://www.timmitchell.net/post/2015/03/16/iterating-through-excel-worksheets-with-biml/
Arnaud

Accessing a datatable via a string variable

This is probably one of those that is so simple I can't see it. I have a string variable called Market. The variable is user chosen and is the exact same name as one of many tables in my dataset. Basically I am having the user choose which table they want in a combobox, then I want to use that variable to access the table. So if the user picks "Market1" then I want to open the table named Market1.
I am simplifying here, but need to know how to open:
For ds.<variable here>.rows.count - 1
'perform steps
Next
How do I inject the variable correctly? Thanks ahead of time!
Dataset has Tables property, which accepts table name as a parameter. So in your case if string variable Market holds table name, you can access the table by referring to ds.Tables(Market)