> thanks russ & jim........
> got that variable done correctly.
[quoted text clipped - 4 lines]
> i also HAD to enter blnFirst=True at the beginning of my command macro,
> because if i don't, it doesn't pick up on the statement:
> i tested this several times.
>
[quoted text clipped - 5 lines]
> thank you
> susan

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
> Susan,
> Show us the code where you trying to use blnFirst.
ok, you asked for it <cringe>!
i'm not giving you the whole code past opening the 1st file, cuz it's
ridiculously long & repetitive. & yes, it looks like it might be the
"private" sub issue.
(of course, so is this, but you asked for it).
:) susan
xxxxxxxxxxxxxxxxxxxxxxxxx
Option Explicit
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdNext_Click()
If txtYear.Value = "" Then
MsgBox "You haven't entered the year!" _
, vbOKOnly + vbCritical
txtYear.SetFocus
Exit Sub
End If
If txtCounty.Value = "" Then
MsgBox "You haven't entered the county!" _
, vbOKOnly + vbCritical
txtCounty.SetFocus
Exit Sub
End If
If txt1stName.Value = "" Then
MsgBox "You haven't entered the client's first name!" _
, vbOKOnly + vbCritical
txt1stName.SetFocus
Exit Sub
End If
If txt2ndName.Value = "" Then
MsgBox "You haven't entered the client's last name!" _
, vbOKOnly + vbCritical
txt2ndName.SetFocus
Exit Sub
End If
If txtAddress.Value = "" Then
MsgBox "You haven't entered the address!" _
, vbOKOnly + vbCritical
txtAddress.SetFocus
Exit Sub
End If
If txtTown.Value = "" Then
MsgBox "You haven't entered the town!" _
, vbOKOnly + vbCritical
txtTown.SetFocus
Exit Sub
End If
If txtRecord.Value = "" Then
MsgBox "You haven't entered the deed recording date!" _
, vbOKOnly + vbCritical
txtRecord.SetFocus
Exit Sub
End If
If txtBook.Value = "" Then
MsgBox "You haven't entered the deed book number!" _
, vbOKOnly + vbCritical
txtBook.SetFocus
Exit Sub
End If
If txtPage.Value = "" Then
MsgBox "You haven't entered the deed page/instrument number!" _
, vbOKOnly + vbCritical
txtPage.SetFocus
Exit Sub
Else
Me.MultiPage1("pgChoose").Enabled = True
Me.MultiPage1.Value = 1
Me.MultiPage1("pgChoose").chkLCHOME.SetFocus
End If
End Sub
Private Sub frmGenerateMortgages_Initialize()
Dim chkAHC As Control
Dim chkNCHC As Control
Dim chkLCHOME As Control
Dim chkHPG As Control
Dim iNCHCAmt As Integer
Dim iLCHOMEAmt As Integer
Dim iHPGAmt As Integer
Dim iYear As Integer
Dim sCounty As String
Dim sName1 As String
Dim sName2 As String
Dim sAddress As String
Dim sTown As String
Dim sVillage As String
Dim dRecord As Date
Dim iBook As Integer
Dim iPage As Integer
Dim sMtg1 As String
Dim sMtg2 As String
Dim blnFirst As Boolean
txtYear.Value = ""
txtCounty.Value = ""
txt1stName.Value = ""
txt2ndName.Value = ""
txtAddress.Value = ""
txtTown.Value = ""
txtVillage.Value = ""
txtRecord.Value = ""
txtBook.Value = ""
txtPage.Value = ""
txtMtg1.Value = ""
txtMtg2.Value = ""
txtSection.Value = ""
txtBlock.Value = ""
txtLot.Value = ""
With cboYears
.AddItem "Two"
.AddItem "Five"
.AddItem "Ten"
End With
cboYears.Value = ""
With Me
MultiPage1.Value = 0
txtYear.SetFocus
End With
End Sub
Private Sub cmdGenerate_Click()
Dim chkAHC As Control
Dim chkNCHC As Control
Dim chkLCHOME As Control
Dim chkHPG As Control
Dim iNCHCAmt As Integer
Dim iLCHOMEAmt As Integer
Dim iHPGAmt As Integer
Dim iYear As Integer
Dim sCounty As String
Dim sName1 As String
Dim sName2 As String
Dim sAddress As String
Dim sTown As String
Dim sVillage As String
Dim dRecord As Date
Dim iBook As Integer
Dim iPage As Integer
Dim sMtg1 As String
Dim sMtg2 As String
Dim blnFirst As Boolean
With Me
If .chkAHC.Value = True And blnFirst = True Then
blnFirst = False
.MultiPage1("pgAdditional").Enabled = True
.MultiPage1.Value = 2
.MultiPage1("pgAdditional").txtSection.SetFocus
With cboYears
.AddItem "Two"
.AddItem "Five"
.AddItem "Ten"
End With
cboYears.Value = ""
MsgBox "Please fill in additional AHC information", _
vbOKOnly + vbInformation
Exit Sub
End If
If blnFirst = False Then
If .chkNCHC.Value = True Then
ChangeFileOpenDirectory _
"\\Server\susan\My Documents\Note & Mortgages\"
Documents.Open FileName:="""DANC Snowbelt Gt &
Mortgage.doc""", _
ConfirmConversions:=True, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
Revert:=False, _
WritePasswordDocument:="",
WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
blah blah blah more code
End if
End If
End With
End Sub
Susan - 05 Oct 2006 19:48 GMT
you know what? ignore that last post.....
i read up on public vs. private scope, & i think that is the issue.
i'm going to keep working with it & if/when i can't solve it, or i run
into a new issue, i'll start a new post.
thanks a lot for your help!
susan
Russ - 06 Oct 2006 08:09 GMT
Susan,
>> Susan,
>> Show us the code where you trying to use blnFirst.
[quoted text clipped - 84 lines]
>
> Private Sub frmGenerateMortgages_Initialize()
This is what I meant by the initialization subroutine.
This is the subroutine that gets read once when the form starts. So set
blnFirst = True here. So it only gets set to True once at the beginning.
> Dim chkAHC As Control
> Dim chkNCHC As Control
[quoted text clipped - 16 lines]
> Dim sMtg2 As String
> Dim blnFirst As Boolean
blnFirst = True
> txtYear.Value = ""
> txtCounty.Value = ""
[quoted text clipped - 49 lines]
> Dim sMtg2 As String
> Dim blnFirst As Boolean
Shouldn't need to declare here it, also.
Already declared above in initialization subroutine and set to True there,
too.
> With Me
> If .chkAHC.Value = True And blnFirst = True Then
Now it will only be True the first time through each time the userform is
started because you flip it to False in next statement. Of course,
.chkAHC.Value *also* has to be True in order to execute the next line.
> blnFirst = False
> .MultiPage1("pgAdditional").Enabled = True
[quoted text clipped - 34 lines]
>
> End Sub

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID