borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Access and vb.Net)Next Topic (Build a database system?) New Topic New Poll Post Reply
AndreaVB Forum : Database : Help on SQL querry ...
Poster Message
sneha
Level: Scholar

Registered: 28-03-2006
Posts: 29

icon Help on SQL querry ...

quote:
Chris_871 wrote:
Hi

Insert query for your sales table..


SqlSales = "Insert into Sales (CustomerName,InvoiceNo,InvoiceDate,InvoiceAmount) values ('" & trim(custname) & "','" & trim(invno) & "'," & (invdate) & "," & (invamt) & ")"

Regards
Chris



Thanks.

Actually I need the Insert Querry for the Target Table " AccountsBalance" with the following fields from Sales table and Payment table:

CustomerName
InvoiceDate
InvoiceAmount

from Sales table &

PaymentDate
PaymentReceived

from Payment table

Thanks in Advance.


____________________________
Sneha
29-03-2006 at 08:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
Chris_871
Level: Master


Registered: 30-11-2002
Posts: 106
icon Re: Help on SQL querry ...

Hi

In your payment and Accountbalance table , you should have invoiceno field. Then only you can insert into accountbalance table. Also you may receive myltiple payments for a single invoice. So you should design your table according to that.

Here is the insert qiery..

Insert into accountbalance (customername,invoicedate,invoiceamount,paymentdate,paymentreceived,invoiceno)
(select sales.customername,sales.invoicedate,sales.invoiceamount,payment.paymentdate,payment.paymentreceived,payment.invoiceno from sales,payment where sales.invoiceno = payment.invoiceno and sales.invoiceno = '1001')


In this query I have used sales.invoiceno = '1001'.
You may use like this,

sales.invoiceno = '" & trim(txtinvno.text) & "'


Regards
Chris

29-03-2006 at 09:35 AM
View Profile Send Email to User Show All Posts | Quote Reply
sneha
Level: Scholar

Registered: 28-03-2006
Posts: 29
icon Re: Help on SQL querry ...

Hi,

Could you please write querry for my tables which I have mentioned in the above post. Please note that there is no relation between any fields from Sales table to Payment table.

Regards.

____________________________
Sneha

29-03-2006 at 01:51 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Help on SQL querry ...

Please do not make duplicate posts.

http://www.andreavb.com/forum/viewtopic.php?TopicID=6580&page=0#23436

[Edited by Goran on 30-03-2006 at 12:40 AM GMT]

____________________________
If you find the answer helpful, please mark this topic as solved.

29-03-2006 at 11:38 PM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: Help on SQL querry ...

Hi sneha,
Can you mark this as solved or not pls?
K


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

02-04-2006 at 05:24 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Help on SQL querry ...
Previous Topic (Access and vb.Net)Next Topic (Build a database system?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder