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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB CODES TO POPULATE A FORM/REPORT

Status
Not open for further replies.

Gemini07306

Technical User
Jun 25, 2003
15
US
Hello Tek-Tips profs.
cc: Jrbarnett
Thanks for your response on the File handling (FreeFile) tip. I was able to accomplish the objective on creating an 'extract file' from an existing table. Access '97.
I probably didn't spell out some of the difficulties properly.
Here they are:
They are 4 existing objects: Table1, Extract1(also in table format), Form1 and Report1.
Table1 fields:
------------------------------
A B C D DATE1
5 10 8 10 10/21/2003


Extract1 fields:
--------------------------
X1 X2 X3 Dateout
? ? ? 2003


Form1:( Have controls - textboxes that will display the values that will come from Extract1)

Report1: (Will also display the values that will be coming from Extract1)

Note: All the above objects already exist but the Extract1 file is empty.

Required process:
(1a) I will need to place a control(Command button) on a form, and this is where my codes will be imbedded.

(1b) I need VB codes(sample format) to enable use the values in Table1, perform calculations such as:
(A+B+C) and store the result in Extract1 field "X1",
take the "D" value from Table1 and store it in Extract1 field "X2", take only the year "2003" from Table1 and store it in Extract1 'Dateout' field.

(2) Because 'Form1' will be utilized more than once,
I need the VB code to Zero or space out the content of the 'textboxes' before repopulating the form with fresh data.

As for Report1, the data(source data) will be coming
directly from the Extract1. That won't be a problem.
Note: I can use Access calculated controls on the Form1 in manipulating the values from Table1, but I cannot use calculated controls in the Report1 Detail section.

EXAMPLE:

Private Sub Command1_Click()

What fields/recordsets do I have to "Dim" here?
Move year field from Table1 to Extract1
Perform calculations using values from Table1 and store the results in Extract1
Zero/space out Form1
Use the field values from Extract1 and populate the Form1

End Sub

A Million thanks to you all!
gemini07306.

Email: giftx@juno.com
CC gixtian@nyct.com


 
Thanks KenReay, I understand the bound controls for the form. Bur remember, I still need to perform calculattions on the values from table1, then store the results in Extract1, then I can bound the Extract1 fields to my form.
Any urgent response will be very helpful.
Thanks,
gemini07306
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top