Access front end GUI - sql

I have a small SQL database, I want to make a front end GUI for it. VERY basic kind of stuff that basically just allows the user to input data into the GUI which basically just inserts data into the tables from the SQL database. I have the SQL database loaded into Access. I split the database which i think I was supposed to do?? Not sure If i was wrong let me know.
I think I need to usa Visual basic to make the page? I tried tinkering around but I cant seem to find the right instructions online. I basically am just trying to make an Access front end with a GUI that has a couple text boxes that the user will input data into, which will then save into the data to the back end SQL.
Anyone have any direction then can help point me? or if im am just COMPLETELY wrong in doing this that would also be nice to know lol I just thought Ive seen this done somewhere.

First off, your linked tables in Access that link to SQLServer should have the globe icons like this picture:
This means they're linked to the server rather than imported in as a copy of the data. Be sure the tables have primary keys, too; if they're heap tables (ie, no clustered unique index) then the linked tables will be read-only, because Access doesn't know how to send an update query to SQLServer. You can test this by opening one of the linked tables and trying to change data; your cursor won't do anything if it's a read-only table.
To create a super-basic entry form linked to a table, click Insert>Form, then right-click the little square in the upper-left corner of the form and click Properties like this:
Select the table that you want this form to do edits on in the RecordSource property as shown below. You can click the "..." to make a query rather than a single table for the edits, like if you need to join tables, but this gets more complicated because Access gets particular about what queries are still editable and frequently treats the query as read-only if you don't meet all the requirements (for ex, union queries will be read-only):
After you set the RecordSource, click View>Field List and you'll see the fields from the table like this:
Highlight these fields and drag them to the form like this (the unique key fields like ProductID should usually be made invisible, especially if they're autonumber fields, b/c the database will set these, not the user):
Click View>Form View, and you've got yourself an entry form. Use the left-right arrows at the bottom to move through the records, and the asterisk button to create a new record.

Related

Create connection to SQL from VB.net application

I'm looking in to learning some coding and have a small project in mind to begin with,
To begin if anyone could point me in the direction of some good VB.net resources I would be very appreciative,
On a more specific note, I have a few particular questions:
I have a form with several text boxes, how would I go about using this form to establish a connection to an SQL database whereby the boxes on the form are used for (1, servername\instance. 2, database name. 3, sql login. 4,sql password) triggered by pressing the 'connect' button
I also have a form with a single text box, I would like to be able to query a specific table for records where based on primary key = contents of text box. On the form, I'd like to have other text boxes which link to columns on the table and return the value of the associated record.
As a development of the above, I would like to then have a button that writes any changes to the information back on to the record in SQL.
If anyone is able to offer any advise or insight on how I would begin going about this, that would be great.
I would much rather sources of how to learn to do the above that code if possible.
Do several thing or post actual code where you are stuck. it sounds like you will ask about how to put values on Database also. honestly want to say, if you research little bit what you want you will definitely get it. first google and then ask.
because you are in learning phase try to gather as much as knowledge rather copy paste code.
HINTS:
1) set your web.config with connection to sql
see: MSDN document
https://msdn.microsoft.com/en-us/library/ff400235.aspx
2) Then start coding UI
3) on UI you have different boxes, on each button click you should handle separately
search on:
How to open SQL Connection on button click
How to insert new records into a database
and lastly if you came across error then post your issue here.
Good Luck

Displaying Result Of Query In DataGridView In Visual Studio 2012

Ok first off, an important thing to note here is that I've been told to do this whole project without using code to write any of the SQL queries, TableAdapters, DataSources etc.. I've been told to use only Visual Studio's Wizards (not great I know) to generate all the queries and views. All the resources I've been able to find online just don't use the wizards, and are all done through code or older versions of Visual Studio.
Essentially the problem I'm having is that I have created a query on a table "CustomerOrders" which pulls in the FirstName and SecondName from the "Customers" table. All tables linked (database is built and working in access) Executing the Query Preview in the wizard performs as expected showing the correct and relevant columns.
Now the problem arises when I am trying to display this in a DataGridView.
When adding the DataGridView to my form I have to choose a binding source, so I choose the CustomerOrders table. This then displays all the columns in a DataGridView as expected. I then add the FillNames query to the form using the TableAdapterManager "Add Query" wizard.
This places a button on the form, which when pressed executes the query on the DataGridView as expected (it removes columns which I choose to hide in the query) but it does not display the columns from the Customers table - ie. FirstName and SecondName!
That's where the problem is, I can't pull in the names into this DataGridView from a different table other than the one defined in the Data Source (which I can only seem to add the one table to) I need to be able to add the columns from the Customers table into the DataGridView.
I hope this makes sense, and I know most of you will probably be able to do this no problem with code, but one of the requirements is that I do this using the built in Wizards..

Microsoft Access ADP view designer always adds _1 to tables and does not show the fields inside each table

The view designer inside Microsoft Access ADP always adds _1 to all table names, also all table fields are not shown. The only thing that shows inside the table is *(All Columns)
I have tried access 2007 and access 2010 and both have the same output.
Every view inside the database is shown in this way, and the fields never show.
This problem is within a specific database. Other database show normally.
I am forced to make my changes inside the SQL Sever.
I found something on the Microsoft website that says if the database server driver does not have permission then the fields will not populate, but I cannot seem to find a solution.
Please help!!
I found the solution, if someone else has the same issue.
Turns out that the database name included the "." and space character, and this was the source of the problem even though everything else worked fine. Access was not finding the table fields. I renamed the database and the problem was solved.

Exandable table in Microsoft Word form

I'm creating a form in Microsoft Word that will be distributed to various people. One section on the form is a table where the user lists all the tests that he/she has taken and some relevant details about those tests. I don't know in advance how many tests a user has taken, although I can assume it is at least 1. I'd like to create a table that the user can add rows to for each test. Some of the columns will have form controls, one has a drop box, one has check boxes, one has a date picker. I'd like to be able to link these forms with Access once the user has completed them.
Is it possible to create a user expandable table that maintains the form controls in each column?
I am on a Linux machine right now so I can't test and debug code for you, but I have made tables in Word before where the size is decided at runtime (in fact, I did it from Excel, but that is off topic). However, I can tell you the general form is:
expression.Add(BeforeRow)
where expression returns a rows object, such as
ActiveDocument.Tables(1).Rows.Add(5)
Please see microsoft documentation of dealing with
tables:
http://msdn.microsoft.com/en-us/library/office/aa212430%28v=office.11%29.aspx
and rows:
http://msdn.microsoft.com/en-us/library/office/aa223081%28v=office.11%29.aspx
Also, from the VB editor in word, go to help and search "table object members," "row object members," etc.
If this hasn't been closed by tomorrow I will write something up. I will admit, in my experience Word VBA is a bit more temperamental than Excel VBA.

Is there a special sp on SQL server 2008 to get a table change script?

I wonder how management studio generates the change table scripts each time i change a table, especially when i change the datatype from 'text' to 'varchar(max)'.
Peace,
Ice
Update: Concerning the already given Answers i want to precise my question, after say thank you for your posts.
Now, it is like already said, ssms generates the scripts on demand but i want to write a script to identify all the tables in a given database with datatype [text] and change them to [varchar(max)]. So the easy part is to scan the dictionary to find the tables and columns, the harder part is to generate the mentioned scripts which copies all the rows into the new structur.
--> Yes i can work manually thru the list of tables and click in ssms to get the scripts, but there are almost 200 tables... better a computer do that work, isn't it?
If what you're asking is "Given a table, is there an easy way to get the DML used to create that table?" then I don't believe you can just run a system SP and get it. You'd need write something that selected from the system tables to get columns and datatypes, indexes, and everything else.
I wish there was an easy way to generate the same scripts SSMS does (like right-click -> "Modify" on a stored procedure), but it doesn't seem to be that easy.
When you change a table using the Management Studio table designer, the script is already prepared in the background, and you can simply click on the "Generate change script" icon to view it (and copy it if you like).
In SQL 2008, the "Generate change script" option is in the "Table Designer" menu.
If you're asking what it does, it's quite simple: SQL will create a new table with the new structure, copy all the data from the old table, drop the old one and rename the new one. If you open the script as described above, you'd see that.