Situation: The code below is from a code module. Various form modules will call this code and feed the data back to the appropriate form. My hope is to be able to do this dynamically. You my or may not agree on why / how I'm doing this but I do have my reasons. Just not enough time to go into alot of detail. I'm trying to dynamically set a reference to the form that is calling this procedure with out hard coding the name of the form and setting up a bunch of IF Statements. I know how to do that.
Each form has a procedure that calls this routine. There is a public variable that contains the name of the form that is calling this routine: strFormName = Me.Name
I'm trying to dynamically substitue strFormName into
Set Form_Name = Forms!Reports_Form_Wizard<----- This part of this statement. You can't do this as a string. But can you do this a dynamically as an object?
I'm doing this because I have to preface this before the name of each text box in this code module to populate the correct form textboxes. You will find the place I'm refering to highlighted in red below.
Option Compare Database
Option Explicit
Public Sub btnPopulate()
On Error GoTo Err_btnPopulateForm_Click
Dim strUsername As String
Dim strPassword As String
Dim dbs As ADODB.Connection
Dim rsdata As ADODB.Recordset
Dim dbs0 As ADODB.Connection
Dim rsData0 As ADODB.Recordset
Dim dbs1 As ADODB.Connection
Dim rsData1 As ADODB.Recordset
Dim strSql As String
Dim strSQL_Create_Table As String
Dim strSelect As String
Dim strSelect_Again As String
Dim strInsert As String
Dim strClient As String
Dim strInitial As String
Dim lngCommaPosition As Long
Dim lngClient_Length As Long
Dim lngInitial_Length As Long
Dim lngQuery_Case As Long
Dim lngAmpersandPosition As Long
Dim lngPeriodPosition As Long
Dim lngUnwantedChar As Long
Dim blnSplit_This As Boolean
Dim lngPrimary_Second As Long
' Dim strplanner As String
' Dim strSSN As String
' Dim strAccountno As String
Dim txtplanner As String 'done
Dim txtprimarylast As String
Dim txtprimaryfirst As String
Dim txtPrimaryPrefix As String
Dim txtsecondarylast As String
Dim txtsecondaryfirst As String
Dim txtsecondaryprefix As String
Dim txtAccountNumber As String 'done
Dim txtSSN As String 'done
Dim txtAddress1 As String
Dim txtAddress2 As String
Dim txtAddress3 As String
Dim txtCity As String
Dim txtState As String
Dim txtZip As String
Dim txtPrimarySSN As String
Dim txtSecondarySSN As String
Dim txtPrimaryDOB As String
Dim txtSecondaryDOB As String
Dim txtPrimaryMiddle As String
Dim txtCityStateZip As String
Dim Form_Name As Form
Dim ThisProject As CurrentProject
Set Form_Name = Forms!Reports_Form_Wizard
'DoCmd.SetWarnings (0)
strUsername = "sa"
strPassword = ""
' Open DB connection
Set dbs = New ADODB.Connection
dbs = "PROVIDER=SQLOLEDB;DATA SOURCE=GOLDMINE;DATABASE=
dbs.Open dbs, strUsername, strPassword
strSql = "SELECT CONTACT1.KEY4 AS planner, CONTACT1.LASTNAME AS primarylast,CONTACT2.UMAINMNAM AS PrimaryMiddle, CONTACT2.UMAINFNAME AS primaryfirst, "
strSql = strSql & "CONTACT2.UCLIPRF1 AS PrimaryPrefix,CONTACT2.UNAMELNAM2 AS secondarylast, CONTACT2.UNAMEFNAM2 AS secondaryfirst, CONTACT2.UCLIPRF2 AS SecondaryPrefix, CONTACT1.ACCOUNTNO AS AccountNumber, "
strSql = strSql & "CONTACT2.UCLISSNUM1 AS SSN, CONTACT1.ADDRESS1 AS Address1, CONTACT1.ADDRESS2 AS Address2, CONTACT1.ADDRESS3 AS Address3, "
strSql = strSql & "CONTACT1.CITY AS City, CONTACT1.STATE AS State, CONTACT1.ZIP AS Zip, CONTACT2.UCLISSNUM1 AS PrimarySSN, "
strSql = strSql & "CONTACT2.UCLISSNUM2 AS SecondarySSN, CONTACT2.UCLIDOB AS PrimaryDOB, CONTACT2.UCLIDOB2 AS SecondaryDOB "
strSql = strSql & "FROM CONTACT1 INNER JOIN CONTACT2 ON CONTACT1.ACCOUNTNO = CONTACT2.ACCOUNTNO "
strSql = strSql & "WHERE CONTACT1.ACCOUNTNO = '" & Form_Name.txtAccountInput & "'"
'strSQL = strSQL & "WHERE CONTACT1.ACCOUNTNO = '" & Me.cmbAccount_select & "'"
' Open the Recordset
Set rsdata = New ADODB.Recordset
rsdata.Open strSql, dbs, adOpenDynamic, adLockOptimistic
'txtplanner
'txtprimarylast
'txtprimaryfirst
'txtsecondarylast
'txtsecondaryfirst
'txtAccountNumber
'txtSSN
'txtAddress1
'txtAddress2
'txtAddress3
'txtCity
'txtState
'txtZip
If Not rsdata.EOF Then
If Len(Trim(rsdata("planner"
)) > 0 Then
txtplanner = Trim(rsdata("planner"
)
Form_Name.txtplanner = txtplanner
Else
txtplanner = ""
Form_Name.txtplanner = txtplanner
End If
If Len(Trim(rsdata("primarylast"
)) > 0 Then
txtprimarylast = Trim(rsdata("primarylast"
)
Form_Name.txtprimarylast = txtprimarylast
Else
txtprimarylast = ""
Form_Name.txtprimarylast = txtprimarylast
End If
If Len(Trim(rsdata("primaryfirst"
)) > 0 Then
txtprimaryfirst = Trim(rsdata("primaryfirst"
)
Form_Name.txtprimaryfirst = txtprimaryfirst
Else
txtprimaryfirst = ""
Form_Name.txtprimaryfirst = txtprimaryfirst
End If
If Len(Trim(rsdata("PrimaryMiddle"
)) > 0 Then
txtPrimaryMiddle = Trim(Left(rsdata("primaryMiddle"
, 1))
Form_Name.txtPrimaryMiddle = txtPrimaryMiddle
Else
txtPrimaryMiddle = ""
Form_Name.txtPrimaryMiddle = txtPrimaryMiddle
End If
If Len(txtprimaryfirst) > 0 Then
If Len(txtprimarylast) > 0 Then
Form_Name.txtName = txtprimarylast & "," & " " & txtprimaryfirst
Else
Form_Name.txtName = txtprimaryfirst
End If
Else
If Len(txtprimarylast) > 0 Then
Form_Name.txtName = txtprimarylast
Else
Form_Name.txtName = "Please Supply a Name"
End If
End If
If Len(Trim(rsdata("secondarylast"
)) > 0 Then
txtsecondarylast = Trim(rsdata("secondarylast"
)
Form_Name.txtsecondarylast = txtsecondarylast
Else
txtsecondarylast = ""
Form_Name.txtsecondarylast = txtsecondarylast
End If
If Len(Trim(rsdata("secondaryfirst"
)) > 0 Then
txtsecondaryfirst = Trim(rsdata("secondaryfirst"
)
Form_Name.txtsecondaryfirst = txtsecondaryfirst
Else
txtsecondaryfirst = ""
Form_Name.txtsecondaryfirst = txtsecondaryfirst
End If
If Len(Trim(rsdata("AccountNumber"
)) > 0 Then
txtAccountNumber = rsdata("AccountNumber"
' point this where you will
End If
If Len(Trim(rsdata("SSN"
)) > 0 Then
txtSSN = Trim(rsdata("SSN"
)
Form_Name.txt_SSN1_Before = txtSSN
Call Parse_SSN(txtSSN)
Form_Name.txtSSN = txtSSN
Else
txtSSN = ""
Form_Name.txtSSN = txtSSN
End If
If Len(Trim(rsdata("Address1"
)) > 0 Then
txtAddress1 = Trim(rsdata("Address1"
)
Form_Name.txtAddress = txtAddress1
Else
txtAddress1 = ""
Form_Name.txtAddress = txtAddress1
End If
If Len(Trim(rsdata("Address2"
)) > 0 Then
txtAddress2 = Trim(rsdata("Address2"
)
Form_Name.txtAddress2 = txtAddress2
Else
txtAddress2 = ""
Form_Name.txtAddress2 = txtAddress2
End If
If Len(Trim(rsdata("Address3"
)) > 0 Then
txtAddress3 = Trim(rsdata("Address3"
)
Form_Name.txtAddress3 = txtAddress3
Else
txtAddress3 = ""
Form_Name.txtAddress3 = txtAddress3
End If
If Len(Trim(rsdata("City"
)) > 0 Then
txtCity = Trim(rsdata("City"
)
Form_Name.txtCity = txtCity
Else
txtCity = ""
Form_Name.txtCity = txtCity
End If
If Len(Trim(rsdata("State"
)) > 0 Then
txtState = Trim(rsdata("State"
)
Form_Name.txtState = txtState
Else
txtState = ""
Form_Name.txtState = txtState
End If
If Len(Trim(rsdata("Zip"
)) > 0 Then
txtZip = Trim(rsdata("Zip"
)
Form_Name.txtZip = txtZip
Else
txtZip = ""
Form_Name.txtZip = txtZip
End If
If Len(txtCity) > 0 Then
If Len(txtState) > 0 Then
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = txtCity & ", " & txtState & " " & txtZip
Else
Form_Name.txtCityStateZip = txtCity & ", " & txtState
End If
Else
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = txtCity & ", State Unknown " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & txtZip
End If
End If
Else
If Len(txtState) > 0 Then
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = "City Unknown" & ", " & txtState & " " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", " & txtState & " ZIP Code Unknown"
End If
Else
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & "ZIP Code Unknown"
End If
End If
End If
If Len(Trim(rsdata("PrimarySSN"
)) > 0 Then
txtPrimarySSN = Trim(rsdata("PrimarySSN"
)
txtSSN = txtPrimarySSN
Call Parse_SSN(txtSSN)
txtPrimarySSN = txtSSN
Form_Name.txtPrimarySSN = txtPrimarySSN
Else
Form_Name.txtPrimarySSN = ""
End If
If Len(Trim(rsdata("SecondarySSN"
)) > 0 Then
txtSecondarySSN = Trim(rsdata("SecondarySSN"
)
txtSSN = txtSecondarySSN
Form_Name.txt_SSN2_Before = txtSSN
Call Parse_SSN(txtSSN)
txtSecondarySSN = txtSSN
Form_Name.txtSecondarySSN = txtSecondarySSN
Else
Form_Name.txtSecondarySSN = ""
End If
If Len(Trim(rsdata("PrimaryDOB"
)) > 0 Then
If IsDate(CVDate(Trim(rsdata("PrimaryDOB"
))) Then
txtPrimaryDOB = Trim(rsdata("PrimaryDOB"
)
Else
txtPrimaryDOB = Trim(rsdata("PrimaryDOB"
) & ": Invalid DOB"
End If
Form_Name.txtPrimaryDOB = txtPrimaryDOB
Else
Form_Name.txtPrimaryDOB = ""
End If
If Not IsNull(rsdata("SecondaryDOB"
) Then
If IsDate(CVDate(Trim(rsdata("SecondaryDOB"
))) Then
txtSecondaryDOB = Trim(rsdata("SecondaryDOB"
)
Else
txtSecondaryDOB = Trim(rsdata("SecondaryDOB"
) & ": Invalid DOB"
End If
Form_Name.txtSecondaryDOB = txtSecondaryDOB
Else
Form_Name.txtSecondaryDOB = ""
End If
' rsData.MoveNext
End If
If Len(Trim(rsdata("PrimaryPrefix"
)) > 0 Then
txtPrimaryPrefix = Trim(rsdata("PrimaryPrefix"
)
Select Case UCase(txtPrimaryPrefix)
Case "MR."
Form_Name.chkPrimaryMr = -1
Form_Name.chkPrimaryMrs = 0
Form_Name.chkPrimaryMs = 0
Case "MR"
Form_Name.chkPrimaryMr = -1
Form_Name.chkPrimaryMrs = 0
Form_Name.Form_Name.chkPrimaryMs = 0
Case "MRS."
Form_Name.chkPrimaryMrs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMs = 0
Case "MRS"
Form_Name.chkPrimaryMrs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMs = 0
Case "MISS"
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MISS."
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MS."
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MS"
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case Else
Form_Name.chkPrimaryMs = 0
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
End Select
Else
Form_Name.chkPrimaryMs = 0
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
End If
Form_Name.Repaint
rsdata.Close
Set rsdata = Nothing
strFormName = ""
Exit_btnPopulateForm_Click:
Exit Sub
Err_btnPopulateForm_Click:
MsgBox Err.Description
Resume Next
Resume Exit_btnPopulateForm_Click
End Sub
Each form has a procedure that calls this routine. There is a public variable that contains the name of the form that is calling this routine: strFormName = Me.Name
I'm trying to dynamically substitue strFormName into
Set Form_Name = Forms!Reports_Form_Wizard<----- This part of this statement. You can't do this as a string. But can you do this a dynamically as an object?
I'm doing this because I have to preface this before the name of each text box in this code module to populate the correct form textboxes. You will find the place I'm refering to highlighted in red below.
Option Compare Database
Option Explicit
Public Sub btnPopulate()
On Error GoTo Err_btnPopulateForm_Click
Dim strUsername As String
Dim strPassword As String
Dim dbs As ADODB.Connection
Dim rsdata As ADODB.Recordset
Dim dbs0 As ADODB.Connection
Dim rsData0 As ADODB.Recordset
Dim dbs1 As ADODB.Connection
Dim rsData1 As ADODB.Recordset
Dim strSql As String
Dim strSQL_Create_Table As String
Dim strSelect As String
Dim strSelect_Again As String
Dim strInsert As String
Dim strClient As String
Dim strInitial As String
Dim lngCommaPosition As Long
Dim lngClient_Length As Long
Dim lngInitial_Length As Long
Dim lngQuery_Case As Long
Dim lngAmpersandPosition As Long
Dim lngPeriodPosition As Long
Dim lngUnwantedChar As Long
Dim blnSplit_This As Boolean
Dim lngPrimary_Second As Long
' Dim strplanner As String
' Dim strSSN As String
' Dim strAccountno As String
Dim txtplanner As String 'done
Dim txtprimarylast As String
Dim txtprimaryfirst As String
Dim txtPrimaryPrefix As String
Dim txtsecondarylast As String
Dim txtsecondaryfirst As String
Dim txtsecondaryprefix As String
Dim txtAccountNumber As String 'done
Dim txtSSN As String 'done
Dim txtAddress1 As String
Dim txtAddress2 As String
Dim txtAddress3 As String
Dim txtCity As String
Dim txtState As String
Dim txtZip As String
Dim txtPrimarySSN As String
Dim txtSecondarySSN As String
Dim txtPrimaryDOB As String
Dim txtSecondaryDOB As String
Dim txtPrimaryMiddle As String
Dim txtCityStateZip As String
Dim Form_Name As Form
Dim ThisProject As CurrentProject
Set Form_Name = Forms!Reports_Form_Wizard
'DoCmd.SetWarnings (0)
strUsername = "sa"
strPassword = ""
' Open DB connection
Set dbs = New ADODB.Connection
dbs = "PROVIDER=SQLOLEDB;DATA SOURCE=GOLDMINE;DATABASE=
dbs.Open dbs, strUsername, strPassword
strSql = "SELECT CONTACT1.KEY4 AS planner, CONTACT1.LASTNAME AS primarylast,CONTACT2.UMAINMNAM AS PrimaryMiddle, CONTACT2.UMAINFNAME AS primaryfirst, "
strSql = strSql & "CONTACT2.UCLIPRF1 AS PrimaryPrefix,CONTACT2.UNAMELNAM2 AS secondarylast, CONTACT2.UNAMEFNAM2 AS secondaryfirst, CONTACT2.UCLIPRF2 AS SecondaryPrefix, CONTACT1.ACCOUNTNO AS AccountNumber, "
strSql = strSql & "CONTACT2.UCLISSNUM1 AS SSN, CONTACT1.ADDRESS1 AS Address1, CONTACT1.ADDRESS2 AS Address2, CONTACT1.ADDRESS3 AS Address3, "
strSql = strSql & "CONTACT1.CITY AS City, CONTACT1.STATE AS State, CONTACT1.ZIP AS Zip, CONTACT2.UCLISSNUM1 AS PrimarySSN, "
strSql = strSql & "CONTACT2.UCLISSNUM2 AS SecondarySSN, CONTACT2.UCLIDOB AS PrimaryDOB, CONTACT2.UCLIDOB2 AS SecondaryDOB "
strSql = strSql & "FROM CONTACT1 INNER JOIN CONTACT2 ON CONTACT1.ACCOUNTNO = CONTACT2.ACCOUNTNO "
strSql = strSql & "WHERE CONTACT1.ACCOUNTNO = '" & Form_Name.txtAccountInput & "'"
'strSQL = strSQL & "WHERE CONTACT1.ACCOUNTNO = '" & Me.cmbAccount_select & "'"
' Open the Recordset
Set rsdata = New ADODB.Recordset
rsdata.Open strSql, dbs, adOpenDynamic, adLockOptimistic
'txtplanner
'txtprimarylast
'txtprimaryfirst
'txtsecondarylast
'txtsecondaryfirst
'txtAccountNumber
'txtSSN
'txtAddress1
'txtAddress2
'txtAddress3
'txtCity
'txtState
'txtZip
If Not rsdata.EOF Then
If Len(Trim(rsdata("planner"
txtplanner = Trim(rsdata("planner"
Form_Name.txtplanner = txtplanner
Else
txtplanner = ""
Form_Name.txtplanner = txtplanner
End If
If Len(Trim(rsdata("primarylast"
txtprimarylast = Trim(rsdata("primarylast"
Form_Name.txtprimarylast = txtprimarylast
Else
txtprimarylast = ""
Form_Name.txtprimarylast = txtprimarylast
End If
If Len(Trim(rsdata("primaryfirst"
txtprimaryfirst = Trim(rsdata("primaryfirst"
Form_Name.txtprimaryfirst = txtprimaryfirst
Else
txtprimaryfirst = ""
Form_Name.txtprimaryfirst = txtprimaryfirst
End If
If Len(Trim(rsdata("PrimaryMiddle"
txtPrimaryMiddle = Trim(Left(rsdata("primaryMiddle"
Form_Name.txtPrimaryMiddle = txtPrimaryMiddle
Else
txtPrimaryMiddle = ""
Form_Name.txtPrimaryMiddle = txtPrimaryMiddle
End If
If Len(txtprimaryfirst) > 0 Then
If Len(txtprimarylast) > 0 Then
Form_Name.txtName = txtprimarylast & "," & " " & txtprimaryfirst
Else
Form_Name.txtName = txtprimaryfirst
End If
Else
If Len(txtprimarylast) > 0 Then
Form_Name.txtName = txtprimarylast
Else
Form_Name.txtName = "Please Supply a Name"
End If
End If
If Len(Trim(rsdata("secondarylast"
txtsecondarylast = Trim(rsdata("secondarylast"
Form_Name.txtsecondarylast = txtsecondarylast
Else
txtsecondarylast = ""
Form_Name.txtsecondarylast = txtsecondarylast
End If
If Len(Trim(rsdata("secondaryfirst"
txtsecondaryfirst = Trim(rsdata("secondaryfirst"
Form_Name.txtsecondaryfirst = txtsecondaryfirst
Else
txtsecondaryfirst = ""
Form_Name.txtsecondaryfirst = txtsecondaryfirst
End If
If Len(Trim(rsdata("AccountNumber"
txtAccountNumber = rsdata("AccountNumber"
' point this where you will
End If
If Len(Trim(rsdata("SSN"
txtSSN = Trim(rsdata("SSN"
Form_Name.txt_SSN1_Before = txtSSN
Call Parse_SSN(txtSSN)
Form_Name.txtSSN = txtSSN
Else
txtSSN = ""
Form_Name.txtSSN = txtSSN
End If
If Len(Trim(rsdata("Address1"
txtAddress1 = Trim(rsdata("Address1"
Form_Name.txtAddress = txtAddress1
Else
txtAddress1 = ""
Form_Name.txtAddress = txtAddress1
End If
If Len(Trim(rsdata("Address2"
txtAddress2 = Trim(rsdata("Address2"
Form_Name.txtAddress2 = txtAddress2
Else
txtAddress2 = ""
Form_Name.txtAddress2 = txtAddress2
End If
If Len(Trim(rsdata("Address3"
txtAddress3 = Trim(rsdata("Address3"
Form_Name.txtAddress3 = txtAddress3
Else
txtAddress3 = ""
Form_Name.txtAddress3 = txtAddress3
End If
If Len(Trim(rsdata("City"
txtCity = Trim(rsdata("City"
Form_Name.txtCity = txtCity
Else
txtCity = ""
Form_Name.txtCity = txtCity
End If
If Len(Trim(rsdata("State"
txtState = Trim(rsdata("State"
Form_Name.txtState = txtState
Else
txtState = ""
Form_Name.txtState = txtState
End If
If Len(Trim(rsdata("Zip"
txtZip = Trim(rsdata("Zip"
Form_Name.txtZip = txtZip
Else
txtZip = ""
Form_Name.txtZip = txtZip
End If
If Len(txtCity) > 0 Then
If Len(txtState) > 0 Then
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = txtCity & ", " & txtState & " " & txtZip
Else
Form_Name.txtCityStateZip = txtCity & ", " & txtState
End If
Else
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = txtCity & ", State Unknown " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & txtZip
End If
End If
Else
If Len(txtState) > 0 Then
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = "City Unknown" & ", " & txtState & " " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", " & txtState & " ZIP Code Unknown"
End If
Else
If Len(txtZip) > 0 Then
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & txtZip
Else
Form_Name.txtCityStateZip = "City Unknown" & ", State Unknown " & "ZIP Code Unknown"
End If
End If
End If
If Len(Trim(rsdata("PrimarySSN"
txtPrimarySSN = Trim(rsdata("PrimarySSN"
txtSSN = txtPrimarySSN
Call Parse_SSN(txtSSN)
txtPrimarySSN = txtSSN
Form_Name.txtPrimarySSN = txtPrimarySSN
Else
Form_Name.txtPrimarySSN = ""
End If
If Len(Trim(rsdata("SecondarySSN"
txtSecondarySSN = Trim(rsdata("SecondarySSN"
txtSSN = txtSecondarySSN
Form_Name.txt_SSN2_Before = txtSSN
Call Parse_SSN(txtSSN)
txtSecondarySSN = txtSSN
Form_Name.txtSecondarySSN = txtSecondarySSN
Else
Form_Name.txtSecondarySSN = ""
End If
If Len(Trim(rsdata("PrimaryDOB"
If IsDate(CVDate(Trim(rsdata("PrimaryDOB"
txtPrimaryDOB = Trim(rsdata("PrimaryDOB"
Else
txtPrimaryDOB = Trim(rsdata("PrimaryDOB"
End If
Form_Name.txtPrimaryDOB = txtPrimaryDOB
Else
Form_Name.txtPrimaryDOB = ""
End If
If Not IsNull(rsdata("SecondaryDOB"
If IsDate(CVDate(Trim(rsdata("SecondaryDOB"
txtSecondaryDOB = Trim(rsdata("SecondaryDOB"
Else
txtSecondaryDOB = Trim(rsdata("SecondaryDOB"
End If
Form_Name.txtSecondaryDOB = txtSecondaryDOB
Else
Form_Name.txtSecondaryDOB = ""
End If
' rsData.MoveNext
End If
If Len(Trim(rsdata("PrimaryPrefix"
txtPrimaryPrefix = Trim(rsdata("PrimaryPrefix"
Select Case UCase(txtPrimaryPrefix)
Case "MR."
Form_Name.chkPrimaryMr = -1
Form_Name.chkPrimaryMrs = 0
Form_Name.chkPrimaryMs = 0
Case "MR"
Form_Name.chkPrimaryMr = -1
Form_Name.chkPrimaryMrs = 0
Form_Name.Form_Name.chkPrimaryMs = 0
Case "MRS."
Form_Name.chkPrimaryMrs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMs = 0
Case "MRS"
Form_Name.chkPrimaryMrs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMs = 0
Case "MISS"
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MISS."
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MS."
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case "MS"
Form_Name.chkPrimaryMs = -1
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
Case Else
Form_Name.chkPrimaryMs = 0
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
End Select
Else
Form_Name.chkPrimaryMs = 0
Form_Name.chkPrimaryMr = 0
Form_Name.chkPrimaryMrs = 0
End If
Form_Name.Repaint
rsdata.Close
Set rsdata = Nothing
strFormName = ""
Exit_btnPopulateForm_Click:
Exit Sub
Err_btnPopulateForm_Click:
MsgBox Err.Description
Resume Next
Resume Exit_btnPopulateForm_Click
End Sub