Joined
·
30 Posts
this one...
Dim closin As Boolean
Dim amt, newadded As Integer
Dim straugment As String
Private Sub cmdConfirm_Click()
If cmdConfirm.Caption = "&Redo" Then
txtTitle.Enabled = True
txtAuthor.Enabled = True
txtYr.Enabled = True
cboGenre.Enabled = True
cmdConfirm.Caption = "&Confirm"
cmdSave.Enabled = False
Else
txtTitle.Enabled = False
txtAuthor.Enabled = False
txtYr.Enabled = False
cboGenre.Enabled = False
cmdConfirm.Caption = "&Redo"
cmdSave.Enabled = True
End If
End Sub
Private Sub cmdSave_Click()
OpenDB
rs.Open "select * from BookProperty", db, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!AccessionNo = straugment
rs!BookID = txtBookID.Text
rs!Title = txtTitle.Text
rs!Author = txtAuthor.Text
rs!Genre = cboGenre.Text
rs!YearPublished = txtYr.Text
rs!Condition = "Available"
rs.Update
rs.Close
CloseDB
If newadded = amt Then
' Unload Me
' frmBook.Enabled = True
Else
frmBook.txtAdd.Text = Val(frmBook.txtAdd.Text) + 1
newadded = Val(frmBook.txtAdd.Text)
cmdSave.Enabled = False
cmdConfirm.Caption = "&Confirm"
closin = True
Form_Load
End If
End Sub
Private Sub Form_Load()
txtTitle.Enabled = True
txtAuthor.Enabled = True
txtYr.Enabled = True
cboGenre.Enabled = True
amt = Val(frmBook.txtNoToAdd.Text)
If newadded < 2 Then
newadded = Val(frmBook.txtAdd.Text) + 1
straugment = frmBook.cboAccessNo.Text
Else
If amt <= newadded Then
Unload Me
End If
End If
txtAccNo.Text = straugment
txtTitle.Text = frmBook.txtTitle.Text
txtYr.Text = frmBook.txtYrPublished.Text
txtAuthor.Text = frmBook.txtAuthor.Text
cboGenre.Text = frmBook.cboGenre.Text
If amt >= 2 And amt <> newadded Then
GetBookIDbtch
End If
End Sub
Sub GetBookIDbtch()
OpenDB
rs.Open "select count(BookID) as total from BookProperty where AccessionNo like'" & txtAccNo.Text & "'", db, adOpenDynamic, adLockOptimistic
txtBookID.Text = "BK-" & StrConv(Left$(txtTitle.Text, 3), vbUpperCase) & "-" & Hex$(Right$(Format(Time, "HHMM"), 4)) & "-" & Format(rs!total + 1, "0#")
rs.Close
CloseDB
End Sub
Private Sub Form_Unload(Cancel As Integer)
If closin = False Then
If MsgBox("Do you wish to cancel?", vbQuestion + vbYesNo, "Information") = vbYes Then
frmTest.FinishAdd
Cancel = 0
Else
Cancel = 1
End If
Else
frmTest.FinishAdd
Cancel = 0
End If
End Sub
Dim closin As Boolean
Dim amt, newadded As Integer
Dim straugment As String
Private Sub cmdConfirm_Click()
If cmdConfirm.Caption = "&Redo" Then
txtTitle.Enabled = True
txtAuthor.Enabled = True
txtYr.Enabled = True
cboGenre.Enabled = True
cmdConfirm.Caption = "&Confirm"
cmdSave.Enabled = False
Else
txtTitle.Enabled = False
txtAuthor.Enabled = False
txtYr.Enabled = False
cboGenre.Enabled = False
cmdConfirm.Caption = "&Redo"
cmdSave.Enabled = True
End If
End Sub
Private Sub cmdSave_Click()
OpenDB
rs.Open "select * from BookProperty", db, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!AccessionNo = straugment
rs!BookID = txtBookID.Text
rs!Title = txtTitle.Text
rs!Author = txtAuthor.Text
rs!Genre = cboGenre.Text
rs!YearPublished = txtYr.Text
rs!Condition = "Available"
rs.Update
rs.Close
CloseDB
If newadded = amt Then
' Unload Me
' frmBook.Enabled = True
Else
frmBook.txtAdd.Text = Val(frmBook.txtAdd.Text) + 1
newadded = Val(frmBook.txtAdd.Text)
cmdSave.Enabled = False
cmdConfirm.Caption = "&Confirm"
closin = True
Form_Load
End If
End Sub
Private Sub Form_Load()
txtTitle.Enabled = True
txtAuthor.Enabled = True
txtYr.Enabled = True
cboGenre.Enabled = True
amt = Val(frmBook.txtNoToAdd.Text)
If newadded < 2 Then
newadded = Val(frmBook.txtAdd.Text) + 1
straugment = frmBook.cboAccessNo.Text
Else
If amt <= newadded Then
Unload Me
End If
End If
txtAccNo.Text = straugment
txtTitle.Text = frmBook.txtTitle.Text
txtYr.Text = frmBook.txtYrPublished.Text
txtAuthor.Text = frmBook.txtAuthor.Text
cboGenre.Text = frmBook.cboGenre.Text
If amt >= 2 And amt <> newadded Then
GetBookIDbtch
End If
End Sub
Sub GetBookIDbtch()
OpenDB
rs.Open "select count(BookID) as total from BookProperty where AccessionNo like'" & txtAccNo.Text & "'", db, adOpenDynamic, adLockOptimistic
txtBookID.Text = "BK-" & StrConv(Left$(txtTitle.Text, 3), vbUpperCase) & "-" & Hex$(Right$(Format(Time, "HHMM"), 4)) & "-" & Format(rs!total + 1, "0#")
rs.Close
CloseDB
End Sub
Private Sub Form_Unload(Cancel As Integer)
If closin = False Then
If MsgBox("Do you wish to cancel?", vbQuestion + vbYesNo, "Information") = vbYes Then
frmTest.FinishAdd
Cancel = 0
Else
Cancel = 1
End If
Else
frmTest.FinishAdd
Cancel = 0
End If
End Sub