Next Generation Emulation banner
1 - 7 of 7 Posts

·
Registered
Joined
·
30 Posts
Discussion Starter · #1 ·
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
 

·
Knowledge is the solution
Joined
·
7,168 Posts
1. you might want to use the [noparse]
Code:
[/noparse] tags just so the code has better readability

2. The debugger is there for a reason. Follow your code execution step per step and find the conflicting line. Personally I think that 'select *' line looks suspicious, if your DB is way too large you might be trying to bite more than you can chew there, which would explain he stack overflow. redesign your db request so that you only read the columns you strictly need.
 

·
AKA snkmad
Joined
·
4,030 Posts
That's C#?
 

·
Banned
Joined
·
23,263 Posts
eww, give up on that crap. .net 1.0 doesn't even install on x64 os's so you'll never get the runtime you need.
 

·
Knowledge is the solution
Joined
·
7,168 Posts
it really depends on what he needs to do, the right tool for the task at hand and stuff. If his only users are 32bits OS then he doesn't really have to worry about other cases. :/
 
1 - 7 of 7 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top