PDA

Click to See Complete Forum and Search --> : Please help with Data Project (Newbie)


luka
Sep 1st, 1999, 06:16 AM
Hi, (using VB6)
I'm creating a simple employee payroll program that gives you a list
of employee information (Name, Address, etc.) and compiles their
wages on a monthly bassis.
I've created two tables in Access (payroll.mbd). The Employee Table
stores all the personal data and the Expenses Table compiles their
monthly income. All of this information is displayed in Text Boxes
and MaskedEdit Boxes.
The form also has only one ADO Control and this brings me to this:
In the ADO control Property Pages, RecordSource tab I choose the
Command Type as "1 -adCmdText" and in the Command Text(SQL) box I
entered "SELECT * FROM Employees,Expenses;".
Now all of the Data Fields are displayed in the Text Boxes Properties Window.
In a command button (Private Sub cmdAdd_Click) I added the command:
"adcPayroll.Recordset.AddNew" so that I could compile a new monthly income and the problem is that all of the information is removed
including the Employee Info.
How can I keep the Employee Info and just get rid of the old monthly
income? Do I need to add another ADO Control to the form?
I hope this is clear enough and I really appreciate all of the
assistance I have received so far.
Thanks..Ron Lukawitski

Gary@JSD
Sep 14th, 1999, 01:26 PM
It is better to have 2 ADO's (my opinion anyway). Use one ADO to select the employee information and then use the other ADO to extract the expenses details depending on which record is selected. (If you use a DBcombo box you can allow the user to select different employees - then using the DBCombo1.Click event you can insert code that selects the expenses record by "Select * from [expenses] where [employee]=" + dbcombo1.text

Then when you add the new record only the expenses data will change, the employee will remain the same. You could of course choose to edit the expenses rather than add a new record.

Hope this helps.