Computing.Net > Forums > Programming > VB6sp6 Package & Deployment Wizard

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB6sp6 Package & Deployment Wizard

Reply to Message Icon

Original Message
Name: Mark Long
Date: July 8, 2004 at 10:37:29 Pacific
Subject: VB6sp6 Package & Deployment Wizard
OS: win 98
CPU/Ram: 300/512
Comment:

1. I am trying to use the Package & Deployment Wizard for a project I have created. I have had no problem getting so far but when I get to about the final stage & the wizard is about to do it's thing and in view are the paths where the files will be created I assume. Once these files have been created do I have to search my H/D for them and then bundle them together as this is the impression I am getting & it must be wrong. In raw english could someone please explain what is happening and how I go about achieving the desired effect. I need to include VB and Access CAB files etc?

2. I have an Access db and a field formatted to Currency £, all the values display as they should eg.£1.99 in the db. My problem arises when I want to view these on a forms textbox, I have formatted the the textbox to currency but display shows 1.99 if the value is say £1.50 it only displays 1.5. How do I get it to display how I need it to £1.50 ?

3. I am having no luck in getting this question answered so I will try to explain it differently.

Access db table has 2 fields - Cost & Quantity, I need to be able to calculate the sum of Cost * Quantity = X (No Problem) but once I have value X for this record I need the value X for the next record in the database and so on until End Of File is reached. Once all values of X have been calculated I need to add them up together to give a grand total as this is the value I wish to display in a textbox on the form.

Any help greatly appreciated as I am beginning to struggle big time now on a relatively straight forward project.

Regards


M


Report Offensive Message For Removal


Response Number 1
Name: RugZ
Date: July 9, 2004 at 09:20:33 Pacific
Reply: (edit)

For your package deployment wizard you need to compile...or create an exe and save it in a particular folder. When you are packaging you will need to Use the same folder to save your cab files etc....Not so when you create the folder for group program....Initially when you dont specify where your program will be installed , the installer send it to Program Files Folder.

2. When You format your text box dont be tempeted to format using currency...Instead format using custom and specify the format mask...Just the way you do it in excel....For example a format would be like
"("£#,##0.00")"........(Am not sure of the format mask's format)

3. For your third problem try

*Assuming You are using data environment

Sub GrandTotal()
Dim I As Integer
Dim Increment As Long
Dim Quantity As Integer
Dim Cost As Currency
Dim X As Long

With DataEnvironment1.Connection1.Command1
If .RecordCount=0 then
Exit Sub
Else
.MoveFirst

For I = 1 to .RecordCount
Quantity=.Fields("Quantity") 'Quantity field
Cost=.Fields("Cost") 'Cost field
X= Quantity * Cost 'The calculation
Increment= Increment + X 'Icrement the total
.MoveNext 'To move to the next record
If .EOF Then 'End Of File
txtGrandTotal.Text=Increment 'The textbox
Exit For
End If
Next I
End If
End with
End Sub


Report Offensive Follow Up For Removal

Response Number 2
Name: Mark Long
Date: July 9, 2004 at 17:26:57 Pacific
Reply: (edit)

Thanks RugZ that looks like exactly what I need on all counts. However I do not quite understand the 'With' statement and what it it doing. My code would read:

With datTingleLine.Recordset.Command1

but what should I replace command1 with, what does it represent? I intent to place the code in Form_Activate but my VB is pretty poor, what is with all the Sub & End Sub how will I cope with them.

Please bear with my lack of understanding while I confuse myself further.


Report Offensive Follow Up For Removal

Response Number 3
Name: RugZ
Date: July 12, 2004 at 03:36:19 Pacific
Reply: (edit)

OK I see you are using the ADO data control...not the data environment

The With Statement basically initializes the object you are using and also helps minimize typing....for instance if you want to move to the next record instead of typing

datTingleLine.Recordset.MoveNext ...You could have
With datTingleLine.Recordset
.MoveNext
End With

This is particulary useful if you have lots of lines of code
For your case you dont need to initialize upto....datTingleLine.Recordset.Command1...
Instead you only need to initialize upto
datTingleLine.Recordset to be able to access the ADO Data control's methods (eg .MoveNext is a method) and properties (eg .RecordCount is a property) by preceeding them with a period (.)

The Sub GrandTotal() that I included is only a sub-routine or sub program that you would write in the declarations section of your form (...General....).You can then call the sub-routine in your Form_Initialize() event eg
Private Sub Form_Initialize()
Call GrandTotal
End Sub

or alternatively

Private Sub Form_Initialize()
GrandTotal
End Sub

So in your case you could have the following code in your Form_Initialize() event
i.e.

Private Sub Form_Initialize()

Dim I As Integer
Dim Increment As Long
Dim Quantity As Integer
Dim Cost As Currency
Dim X As Long

With datTingleLine.Recordset
If .RecordCount= 0 then
Exit Sub
Else
.MoveFirst

For I = 1 to .RecordCount
Quantity=.Fields("Quantity") 'Quantity field
Cost=.Fields("Cost") 'Cost field
X= Quantity * Cost 'The calculation
Increment= Increment + X 'Icrement the total
.MoveNext 'To move to the next record
If .EOF Then 'End Of File
txtGrandTotal.Text=Increment 'The textbox
Exit For
End If
Next I
End If
End with

End sub

(This would execute slower if you had lots of lines of code in the Form_Initialize() event)

Or You can write the GrandTotal sub-routine in the general section of your form code module
eg
Sub GrandTotal()

Dim I As Integer
Dim Increment As Long
Dim Quantity As Integer
Dim Cost As Currency
Dim X As Long

With datTingleLine.Recordset
If .RecordCount= 0 then
Exit Sub
Else
.MoveFirst

For I = 1 to .RecordCount
Quantity=.Fields("Quantity") 'Quantity field
Cost=.Fields("Cost") 'Cost field
X= Quantity * Cost 'The calculation
Increment= Increment + X 'Icrement the total
.MoveNext 'To move to the next record
If .EOF Then 'End Of File
txtGrandTotal.Text=Increment 'The textbox
Exit For
End If
Next I
End If
End with

End sub

and then call the sub-program as follows

Private Sub Form_initialize()
GrandTotal
End Sub

(This is much faster)
Hope this works for you...Cheers!!!


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software