Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!:Wrapping It Up: Validation Code And The Invoices Form
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
(Publisher: The Coriolis Group)
Author(s): Peter G. Aitken
ISBN: 1576102815
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Listing 23.8 Command Button Click event procedure for the Invoices form.
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 Save invoice button.
Hide the grid then hide the form.
DataGridItems.Visible = False
InvoiceNumber = 0
Hide
Case 1 Add wine to invoice button.
If txtCustPO.Text = Then
MsgBox (Customer PO required.)
txtCustPO.SetFocus
Exit Sub
End If
Create a new Item.
AdodcItems.Recordset.AddNew
If a new invoice has not been created, then
create a new record in the Invoices table.
If InvoiceNumber = 0 Then CreateNewInvoice (0)
Put the invoice number in the text box that
is bound to that field in the Items table.
txtInvNumber.Text = InvoiceNumber
Call AddWine function, which returns True if the user
selects a wine, False if they Cancel.
If AddWine() Then If a wine was selected
Update the table and refresh it to include
only items that are part of the current invoice.
AdodcItems.Recordset.Update
AdodcItems.RecordSource = _
Select * from Items where InvNo = _
& txtInvNumber.Text
AdodcItems.Refresh
Make the DataGrid visible and refresh it.
DataGridItems.Visible = True
DataGridItems.Refresh
Else If the user canceled entry of a wine,
cancel the new record. It is necessary
to temporarily disconnect the DataGrid
from the ADO Data control to prevent an error.
Set DataGridItems.DataSource = Nothing
AdodcItems.Recordset.CancelUpdate
Set DataGridItems.DataSource = AdodcItems
End
Case 2 Cancel new invoice.
If the user cancels the entire invoice.
If InvoiceNumber <> 0 Then
InvoiceNumber = 0
Delete new records from the Items table.
AdodcItems.Recordset.Filter = adFilterFetchedRecords
AdodcItems.Recordset.Delete adAffectGroup
DataGridItems.Visible = False
Delete new record from the Invoices table.
CreateNewInvoice (InvoiceNumber)
End If
Hide
End Select
End Sub
The final procedure that you need is the AddWine function, which links code in the Invoices form to the Select Wine form. This function, shown in Listing 23.9, is called by code in the Command1_Click event procedure when the user clicks the Add Wine button. It displays the Select Wine form by executing its Show method. The form is displayed modally by passing the argument 1 to the Show method, which means that the user cannot interact with any other forms until this
Wyszukiwarka
Podobne podstrony:
r 23 07Atachment 13 09 23 07 18 38R 23 07 (5)instrukcja serwisowa termet gco 23 07 17 29 0807 (23)07 00 23 m3mi3av2fkgjslwyqiwx27ub4sne4556eeuvzxiTI 97 07 23 N pl23 T44 07 P415s07 (23)TI 97 07 23 N pl(1)więcej podobnych podstron