Visual Studio 2013 LightSwitch How to limit options in popup window when adding linked field data? - sql-server

I have Visual Studio 2013 LightSwitch. My app is deployed to Azure. My SQL database is on Azure. Tables and links are created and working.
Problem 1: In Table A, when adding or updating data, I want to select data from fields in records based on primary key in other tables. Add and update data works. But my popup "X" list is way too long. I want the popup "X" when adding or updating record in Table A to only give me the choice of records from Table B that matches the data I entered in a previous field in Table A, not all the records from Table B.
Problem 2: Then while adding or updating Table A, I want the data from certain fields of the selected record in Table B to be transferred to certain fields in Table A. (Let's say - If I select "ABC" from the popup "X" in Field 2 in Table A, then when I am selecting something from the popup "X" in Field 3 in Table A, I want to select only from the records in Table B that match "ABC" in the primary key field of Table B, not all the records.
Problem 3: If the popup "X" list doesn't include the necessary record to put in Table A, then I want to add a record in Table B to include it in the popup list.
Problem 4: How do I get my popup "X" list to include more than one field? Is creating a new combined field the preferred way?
Problem 4: I also need some good help with user text input and getting the text into my online database. The thought of using an Intrinsic Database gives me the willies.
In your detailed solution, remember I am more familiar with Visual Basic than C#. Thanks.

I'm not quite sure what you mean by popup X list but I'm going to assume you mean an Auto Complete Box control as that would be the default control for linked data. To achieve what you want for problem 1, you need to create a query on Table B with a parameter for the selection field of Table A. You then assign that query to the Auto Complete Box by changing its Choices setting from Auto to your new query. Changing your selection on Table A automatically filters the available selections in your query on Table B.
Beth Massi explains in detail here - there isn't much code involved but her examples are in VB. I'd figure out problem 1 first and then see if that helps clarify the remaining ones.

Related

How to store values from a field on excel

this is the first time posting here for me.
I have a quick question about excel. Currently I have an input page where I can input a project name and then fill out details on the project. Is there a way that I can store this information on another sheet? For example, if I type in "Project A" in the project input, then that will be saved in another sheet in a table or something, and the proceeding information (like date, price, etc) will be saved along with it. Then, if I type a new project name in, like "Project B", a new entry will be created with subsequent data.
Thank you!
The ancient Excel data form seems to still exist, even in Excel 2013.
Create a data table with headings and at least one row of data. Select the range and hit Ctrl-T or Insert > Table. This will turn the range into an Excel table.
Now either create a custom group on a ribbon and add the following command to this or your Quick Access Toolbar: All Commands > Form...
Select a cell in the table and hit the Form button that you just inserted into the QAT or the ribbon and you will see a dialog where you can create new rows in the table, and you see a few other buttons to manage data in the table, including deleting rows and searching data in existing rows.
That is the easiest no-code approach.

Inserting a column at the end in a database diagram and repositioning existing columns

I like working on my schema directly within a database diagram. From there, you can set table properties, column properties, add columns, remove, etc. (in addition to, of course, being able to easily define relationships).
However, it doesn't seem to be possible to insert a column at the end of a table's columns or to reposition existing columns. I can insert a column by selecting an existing column and right-clicking > "Insert Column", but that column always appears above the selected column. When I do this and create the column, I cannot drag it to reposition the column despite the drag cursor appearing.
Is there a workaround?
I like to use database diagrams too. If you right click on the header of the table and select Table View -> Standard you will be presented with an editable grid which allows you to add a column to the end of the table.
I should also say that you can also use Table View -> Modify Custom to allow you to modify all attributes of a column such identity etc. Once you have done this you can use Table View -> Custom to be able to update these.
Step 1: User right click on table
Step 2: User left click on "Standard (menu item)"
Step 3: User left click
Step 4: User keyboard input to enter new column
Thank You

Fail to update relational table in access database using VB.NET

I am using access as my database in vb.net
I am using the drag and drop datasource approach to set up its dataset, data grid view , table adapter, table binding source.
I have two table , A and B
A is the parent table, B is children table
So there is a foreign key (say A.id )in B
When i tried to edit A and save it.
There will be an error come out.
It told me that B has a related record of A,
so i cannot modify or del A
I feel very confused of what it means
I did not edit column id in A (which is a foreign key in B) , i just edit others column
I don't understand why i still cannot save it
When i try to save :
the tableAdapterManager is using UpdateAll Method to update whole dataset
I tried to use the tableAdapter of A and B to update their individual dataset.
It comes out the same result no matter what the order of tableAdapter update method is
Really thanks someone who can answer my question :):)

MS access 2007, Single form to multiple tables

i want to work on a form, here i will enter the data into text fields and this will be updated into a table as a new entry. Now out of the fields available iwant few of them to be stored into another table. so its like saving form data into multiple tables. I searched in many places but cudnt find any solution.
The best solution is to use a form and a subform. Table1 is bound to form and Table2 is bound to subform.
Thanks for the solution...i dont want to go for another form though...but i figured out a way..for the 2nd table i introduced a button and on click of the event wrote a vb code such that it will look for ID field of type autonumber(introduced for the sake of searching row) and used dlookup with a criteria expression to find out the row in 2nd table n used a insert statement...this worked...thanks for the response, appreciate it...

Implement a simple many-to-many relation in a Form in OpenOffice.org's Base

I'm doing a small relational database, to be used by one person on a single computer. I chose OpenOffice.org's Base (version 3.1.1) because it's free and should be more than enough for this case. The simplified version of my problem is:
I have an Articles table, with columns: ID, Title, Content, etc....
I have a Keywords table with columns: ID, Keyword.
I have a Relations table with columns: ID, ArticleID, KeywordID
Just a basic, classic, example of a many-to-many relation.
Then I created a form (for the user using the database) using the 'Design view' in Base and linked to the Articles table, which works fine, and allows me to view, edit and created rows in the Articles table.
My problem is how to include the relation to Keywords in that same form. That is, I want the user to be able to view and choose which keyword(s) belongs to the article currently being viewed in the form.
The number of keywords is finite (probably 5-15) if that matters. A preferred setup would be a list of keywords (dynamically linked to the Keywords table of course) in the previously mentioned form I've already created with a check box in front of each keywords
I've tried Google'ing all possible keywords and I've come up with nothing applicable to my case. I belive the answer is somehow using SubForms, or maybe some SQL syntax I'm not familiar with. Any help appreciated.
To answer this in a little more detail, as it comes up early on Google search, please refer to the following video of creating the movies.odb file from scratch:
http://www.youtube.com/watch?v=GYawYO8u3_s
Some further notes on creating this:
Setting up the tables
The principle tables must have an integer primary key that is set to AutoValue
The linking table must have a multi-column primary key, and both columns must be integers
The table relationships must be set in the Relationships... dialog
The relationships disappear if Update options not changed from No action
Setting up the subform
The subform Data >> Content must be set to the mapping table
The subform Data >> Link master fields and Link slave fields must be set to the related fields (as per the Relationships... dialog discussed above)
A table control should be draw (focus must be on the subform at the time, such that the table control sits below the subform in the Form Navigator
A column should be inserted into the table control
The column Data >> Data field should be set to the ID of the related data (i.e. not that of the main form)
The column Data >> Type of list contents should be set to “sql”
The column Date >> List content should be set to “SELECT “Genre Name”, “GenreID” FROM “Genre”” (where Genre Name is the relevant field from the related table, the GenreID is the primary key of that table, and Genre is the related table)
I did some more searching and finally found a solution.
A thread explaining this very issues (among other issues), creating form for a database containing many-to-many relation in Base using a middle table, can be found at:
http://user.services.openoffice.org/en/forum/viewtopic.php?p=16159#p16159
A sample database with a functional form by one of the above thread's posters (DrewJensen) can be found and downloaded at page 2 of the above posted thread. (named movies_2.odb)
A brief description of the solution using my example tables and columns from orginial post:
The trick lies in creating a sub-form linked to the Relations table within the form I had created. That sub-form should contain a Table Control. Then a column should be created in that Table Control. The column should be asigned to the KeywordID column. The "List content" field for that column should then contain: SELECT "Keyword", "ID" FROM "Relations".
(just check out the above link if my instructions are cryptic)

Resources