Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2009, 08:53 PM
Authorized User
 
Join Date: Jan 2009
Posts: 20
Thanks: 5
Thanked 0 Times in 0 Posts
Default saving data from another table in access

Hello readers,

I'm very new with VB6.0. Can you please help me??
There are two tables in my Access DB. Users are inputting Emp_id(PK) in Table1. Under combo_click i need to save all Emp_id from Table1 into emp_id column(FK of Table1) of Table2. It is possible to save date in both table while user inputs but in combo box month name is there, for each month i need to do it once and need to save the month name in separate column in Table2.
Please help me.
 
Old February 11th, 2009, 07:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello.

Can you please post an example of what you need.. is not very clear.

Also you need code or SQL help??
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
The Following User Says Thank You to gbianchi For This Useful Post:
devilz (February 12th, 2009)
 
Old February 12th, 2009, 07:14 PM
Authorized User
 
Join Date: Jan 2009
Posts: 20
Thanks: 5
Thanked 0 Times in 0 Posts
Default


Hello gbianchi,

I'm storing data of employee info in Table1. Emp_id is one of the column name of Table1 which will generate while users are updating employee info from a certain page. In another page i'm going to create Employee roster. in roster creation page combo box is there which consist of month name. First I’m selecting employee id from a combo box. Now which i want is: when i'm selecting month name from combo box i want to save that specific employee id in Table2. month name will also be stored in different column after validation. if the same employee id along with the month name was stored earlier then it will prompt.

gbianchi, you help me in past. Think you wont mind to help me now also. I need sample cove in VB 6.0. Please....
 
Old February 13th, 2009, 07:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Still not seeing where is your problem.

In your second form, you have a combo with months (?) and you are trying to store that selection with the id you get from the first form. And the problem is??? You don't know how to do which part?

From your first form, you past the id to the second form.

(when you call your second form)
Code:
Load SecondForm
SecondForm.EmpoyeId = selectedid
SecondForm.show
In your second form you have a variable like this
Code:
Public Employeid as int
Or long or whatever you need.

When you select from the combo (I don't know if you use a buttom or something else, but...)

first you validate the data with a sql like this.
Code:
SELECT COUNT(*) FROM table2 WHERE month = 'yourselectedmonth' AND employid = theidyougetfromfirstform.
If that count returns 1 then you are trying to insert something that already exists.

Are we going good now?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
The Following User Says Thank You to gbianchi For This Useful Post:
devilz (February 15th, 2009)
 
Old February 15th, 2009, 06:29 AM
Authorized User
 
Join Date: Jan 2009
Posts: 20
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Hello gbianchi,

How could you solve without Identifying the problem??? Ha..Ha..Ha.. Truely your code resolve my problem. Thank you very much for the support.

Regards..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving textbox data into Access iostream212 VB Databases Basics 0 July 20th, 2008 09:58 AM
Saving data to a table through form input misskaos Classic ASP Basics 16 October 2nd, 2006 11:54 AM
Displaying Access table data into Msflexgrid using Kaustav Pro VB Databases 0 September 25th, 2005 01:08 PM
Access Bound forms - auto saving data! jscully Access 6 January 17th, 2005 07:09 PM
Saving a dataset to an Access table smego ADO.NET 0 June 2nd, 2004 01:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.