Hi All,
The following code, while a bit sloppy at the moment, calls a form for agents to enter consumer information. I want to make it populate automatically if data exists in the files already. Help.
The following code, while a bit sloppy at the moment, calls a form for agents to enter consumer information. I want to make it populate automatically if data exists in the files already. Help.
Code:
Sub Main
Dim EmpLgth As String
Dim strV1 As String
Begin Dialog UserDialog 960,329,"New Customer Information" ' %GRID:10,7,1,1
Text 60,208,90,14,"Length of Employment",.Employer4
Text 200,210,50,14,"Years",.Employer2
TextBox 160,28,280,21,.CallerName
TextBox 160,63,280,21,.ServiceAddress,1
TextBox 160,98,280,21,.PhoneNumber
TextBox 160,133,280,21,.LastFourDigitsofSSN
TextBox 160,168,280,21,.CurrentEmployer
TextBox 160,203,30,21,.Length
TextBox 350,203,90,21,.StartDate
TextBox 640,28,280,21,.Auth3rdPartyName
TextBox 640,63,280,21,.CoCustomerName
CheckBox 480,119,190,21,"Customer Accepts Billing",.CoCustomerYes
CheckBox 700,119,220,21,"Bad Debt On Previous Acct?",.BadDebtYes
GroupBox 480,175,440,56,"Service Type",.ServiceTypes
OptionGroup .Services
OptionButton 770,210,120,14,"Gas and Elec",.dualFuel
OptionButton 650,210,100,14,"Gas",.Gas
OptionButton 500,210,100,14,"Electric",.Electric
Text 270,210,70,14,"Start Date",.Text3
Text 60,33,90,14,"Caller Name",.CallName
Text 60,68,90,14,"Address",.NewAddress
Text 60,103,90,14,"Phone Number",.Phone
Text 60,138,90,14,"Social Security Number",.SSN
Text 60,173,90,14,"Employer",.Employer
Text 480,32,140,14,"Authorized 3rd Party",.Text1
Text 480,67,150,14,"Co-Customer Name",.Text2
OKButton 340,287,90,21
CancelButton 530,287,90,21
End Dialog
HeardWord "Wait 2 seconds","Paste"
Dim dlg As UserDialog
result = Dialog(dlg)
If result = -1 Then ' If the user clicked OK,
empLength = dlg.Length
callerName = dlg.CallerName
servAddy = dlg.ServiceAddress
dateIn = dlg.StartDate
phoneNumber = dlg.PhoneNumber
lastFour = dlg.LastFourDigitsofSSN
currEmp = dlg.CurrentEmployer
If dlg.BadDebtYes = 0 Then
badDebt = "No"
ElseIf dlg.BadDebtYes = 1 Then
badDebt = "Yes"
End If
authThird = dlg.Auth3rdPartyName
coCustName = dlg.CoCustomerName
If dlg.CoCustomerYes = False Then
coCustAccept = "No"
ElseIf dlg.CoCustomerYes = True Then
coCustAccept = "Yes"
End If
If dlg.Services = 0 Then
serviceType = "2"
ElseIf dlg.Services = 1 Then
serviceType = "1"
ElseIf dlg.Services = 2 Then
serviceType = "1"
End If
If empLength = "" Then
ElseIf empLength <> "" Then
Open "C:\dragontemp\timeatjob.txt" For Output As #1
Print #1,empLength
Close # 1
End If
Open "C:\dragontemp\name.txt" For Output As #1
Print #1,callerName
Close #1
Open "C:\dragontemp\datein.txt" For Output As #1
Print #1,dateIn
Close #1
Open "C:\dragontemp\newaddress.txt" For Output As #1
Print #1,servAddy
Close #1
Open "C:\dragontemp\phone.txt" For Output As #1
Print #1,phoneNumber
Close #1
Open "C:\dragontemp\service.txt" For Output As #1
Print #1,serviceType
Close #1
Open "C:\dragontemp\employer.txt" For Output As #1
Print #1,currEmp
Close #1
Open "C:\dragontemp\debt.txt" For Output As #1
Print #1,badDebt
Close #1
Open "C:\dragontemp\auth3.txt" For Output As #1
Print #1,authThird
Close #1
Open "C:\dragontemp\cocustomer.txt" For Output As #1
Print #1,coCustName
Close #1
Open "C:\dragontemp\acceptbilling.txt" For Output As #1
Print #1,coCustAccept
Close #1
Open "C:\dragontemp\ssn.txt" For Output As #1
Print #1,lastFour
Close #1
End If
End Sub