Rabu, 5 November 2008

Kesalahan pada satu form - VB6

Nuriman,

I've few finding and queries to ask regarding the code you implemented for Access version. Hope you can give me a good explanation on the implementation you have done below.

1) FORM -> Private Sub Form_Load() , may I know why you apply code below? What is the function for it..

Set rsTemp = RunQuery(dbBackupLCDLabel, "CountSNinDataLog", cboWo.Text)
With rsTemp

If Not .Fields("CountOfSerialNumber") > 0 Then
'Enter Serial Number
msg = "Enter previous valid SN to continue your printing, or cancel to set running number to 0001 "
frmSNo.Show vbModal
Exit Sub
End If

End With

2) Private Sub EnabledField(strInt As Integer), found not following the SQL version. What is the reason for EnabledField(0), set for condition below.
When does this condition apply?

g_sn = Format(Val(g_runNo) + 1, "0000")
txtSN.Text = g_sn

- This will result future if anyone reuse EnableField(0) for other condition will cause g_sn increse incorrectly in frmPrinting.

3) When user key in for authentication pwd to change Panel Warranty in frmPrinting, why display 'Reprint' caption in FrmPwdAuth for frmPrinting.

4) Public Sub UpdateAlligntment(). Pls note to use query in correct condition

Dim dbTemp As Database
Dim qryTemp As QueryDef
dbName = strPath & dbBackupLCDLabel
Set dbTemp = DBEngine.Workspaces(0).OpenDatabase(dbName)
Set qryTemp = dbTemp.QueryDefs("UpdateAllignment")

qryTemp.Parameters(0) = txtVertical.Text
qryTemp.Parameters(1) = txtHorizontal.Text
qryTemp.Parameters(2) = CStr(g_YHorizontal) <= why use to pass in where condition for g_YHorizontal for update. Instead of: UPDATE Allignment SET Allignment.XVertical = [XV], Allignment.YHorizontal = [YH] 6) Private Sub cmdPrint_Click() -> call RunningNo() function how system assign g_runNo to be 0001 OR increase previous runningno + 1?
a) What will be indicate for and serve what purpose of it?

enterRunNo = 0 'entered SN is clear

b) What will be indicate for and serve what purpose of it?

g_runNo

c) Private Function RunningNo(), enterRunNo = 1
currentdate = Format(Right(years, 2), "00") & Format(Month(Date), "00") & Format(Day(Date), "00")
Set rsTemp = RunQuery(dbBackupLCDLabel, "LastSNRecordSet")

If Left(rsTemp.Fields("LastRecord"), 6) = currentdate Then
g_runNo = Mid(rsTemp.Fields("LastRecord"), 7, 4)
ElseIf enterRunNo = 1 Then < = when will this highlite in Green condition to be apply? g_runNo = Mid(g_SNo, 7, 4) Else g_runNo = 0 End If 7) What is the usage of variable TotalPrint = TotalPrint + 1? When will this variable be apply on... 8) Private cmdPrint_click(), found save record after printing still not following in SEQUENCE If confirm = vbYes Then => The squence logic to save should BE
If for (vbYes):
1st step: Call StoreData
2nd step: Check how many SN by WO already printed for closure WO status tracking ( to be update the WO status)
There is 2 ways :
* (1) To be update PrintedQTY 1st then retrive Printed & QTY from table together to do checking
* (2) To be count tb_LCDDataLog of opt for 'Backup Print' if this matches with Qty Or Printed Qty
(with this logic it need to update the PrintedQTY 1st in WorkOrder table)
-> IF check count Printed Qty = Qty
Call EnabledField(0)
Call Form_Load

-> ELSE not tally
=> Getdate() to check is system date still is new date or old date
=> IF Getdate still same with prev txtDt.text value then
- Logic should filter by today date (current date) to get max serial numb and retrive 4 digits + 1
- Then assign txtSN.text = strSerialRun (4 digits - after increment) and txtDt.text = to getdate()
ELSE
- Not same then txtDt.text need to assign with new date and txtSN.text = 0001
- Due to new date assign and reset a new running no starting 0001

else if for (vbNo): Follow logic for SQL version

9) Under Private cmdPrint_click(), why must be PRINTED >= QTY for below code? Instead of PRINTED = QTY then update close status in WO

'condition when printing meet the quantity needed
If printed >= qty Then
Status = "Closed"
End If


If you not understand do come to me for further clarification.

Thanks.


Ini baru kesilapan satu form, ade banyak lagi form yang belum buat pembetulan.... siyes minggu ini aku agak rapat dengan tensi, minggu lepas pon berkawan dengan tensi jugak. Bulan lepas pun same. Aku memang berkawan rapat dengan tensi hahaha. Walau macam mana pun, kehidupan kita semua tak akan terlepas dari berkawan dengan tensi. Ubah pada sudut positive, jadi kan tensi sebagai kawan dalam memaju kan diri. InsyaAllah... arrgh tensi nye

nuriman@cahayanika.com | 019-2678221 |
www.cahayanika.com

1 ulasan:

  1. kamu berkawan dgn tensi..

    sy dah berkahwin dgn tensi.. happily in love lah. loving couple gitu. sampai jadi single balik. tensi bukan?

    BalasPadam