Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create word file template and use data from ms access 1

Status
Not open for further replies.

DwinTheBeginner

Programmer
May 9, 2013
5
PH
I am new in MS ACCESS, Is there someone who could help me with this problem.
I have a ms access database consist of 2 tables 1 is client information and the other is one is
the bank information (checking account). I wanted to create a button that when pressed.
It would create a template a word template that includes a permanent text on it, display some of the
details of the client, including the bank information (information based on a query) and the check they issued for example 5 checks (table format). Thanks in advance.


This is to inform mr.<- permanent (Alfred Chua, Address here) <-from database
with Bank Account number (12467899) <-from database issued 5 checks see table below.

Bank name Branch Check # amount <-from database
Sterling Los Angeles 123456 $1,000.00 <-from database
-----------------------------------------------------------------------------------------

This is to inform mr.Alfred Chua, Address here with Bank Account number (12467899) issued 5 checks see table below.

Bank name / Branch / Check # / amount
Sterling / Los Angeles / 123456 / $1,000.00



 
Do you want to create a VB6 application to do this or just use MSaccess? If the latter then you are in the wrong forum.

It's a long time since I uses Access for this but in general you -
In Access you have to create a query with both tables. Link them by a common ID or customer number that must be in both tables. Click on the join properties line and set so you see every customer and only the bank details where the id's are equal.

The output of this query will show the bank details for each customer.

Create an access form with the fixed text you want and boxes for the names values and set the data input for each box to the corresponding fields in the query.
Put the ID field in a combo box

The data should change when you change customers

In vb6 you do much the same only you cut and pasted the SQL statement from MSaccess and use it's methods in vb6code (fairly complicated for a newbie)
 
Hi sir tedsmith thanks for the quick reply, I actually get your point but the query and relationship that you are referring to I did not include in it, Sorry I wasn't clear enough. MS ACCESS had a VB6 right? but I want to create a button on that form you are referring to and it will create/generate a word document containing those details (using VBcode)
 
>MS ACCESS had a VB6 right?

Wrong. It has VBA, which is not the same thing.
 
The following refers to MSAccess2000 but later versions may do it better.
If you open an Access97 table in later versions you have to convert it to later version to do anything special with it.
But you can manipulate an Access97 table in VB6 without converting it.

In Access -
After you design your query to give the right answer just select Forms and create a table on the form that contains the data.
Use the wizard to do this - it is quite easy - just follow the steps.

You can add a command button or a separate text boxes to enter the name to find. Drag it from the Toolbox

You can assign various activities to the command button to navigate or find a record.
If you click on the button in design you can build and event. This produces basic code that you can add to, to do what you want. It creates a Module that contains the code.

Eg Sub Command1_Click() will operate when you click on the button.
You need to write code in this subroutine that will find the record that matches your text box - similar to vb6 find. See the various examples in help.

Usually you have a separate list or combo box locked to the customers table rather than typing in the name

You can also lock text boxes to fields in the current record if you don't want to see the complete table.

It is possible to save this all so it looks like an .exe rather than to have to open Access all the time

In a VB6 produced .exe it is much the same principle and you don't need to run MSaccess for it to work but the syntax of the SQL string may have to be modified slightly according to vb6 difference rules.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top