G
Gary
I have a button on a form which has an onclick event which populates
fields on the current field using the me.controlname.value =
somevariable
I need to run this for every record in the database.
Is there a quick way of doing this, without opening the form, clicking
the next record, then clicking the button - then clicking the next
record, then clicking the next button etc...
the code i'm using is as follows...
Private Sub Command12_Click()
' new code...
' vartext(6) and vartext(7)
Dim incorporationdate As Integer
Dim countryoforigin As Integer
Dim typeofbusiness As Integer
Dim natureofbusiness As Integer
Dim referencedate As Integer
Dim accountsmadeupto As Integer
Dim accountsdue As Integer
Dim accountsreturn As Integer
Dim explanationofbusiness As Integer
varText = Split(copieddata, vbCrLf)
Me.Company_Name.Value = varText(0)
Me.address1.Value = varText(1)
Me.address2.Value = varText(2)
Me.address3.Value = varText(3)
Me.address4.Value = varText(4)
companynumber = varText(5) ' assign the fifth line to the
variable stringcompanynumber
companyinteger = Mid(companynumber, 13) ' assign the 'number' out of
stringcompanynumber to companynumber
Me.Company_Reg_No.Value = companyinteger ' insert companynumber
into 'company reg no' field.
For intloop = 6 To 10
incorporationdate = intloop + 1
countryoforigin = intloop + 3
typeofbusiness = intloop + 5
natureofbusiness = intloop + 6
explanationofbusiness = intloop + 7
If Len(Trim(varText(intloop) & "")) > 0 Then
Me.status.Value = Mid(varText(intloop), 9)
Me.Date_of_Incorporation.Value = Mid(varText(incorporationdate), 25)
Me.biztype.Value = varText(typeofbusiness)
Me.[SIC Explanation].Value = varText(explanationofbusiness)
Me.Refresh
End
' varText(intLoop) contains a value
Else
' varText(intLoop) doesn't contain a value
End If
Next intloop
Thanks for your help,
Gary-
fields on the current field using the me.controlname.value =
somevariable
I need to run this for every record in the database.
Is there a quick way of doing this, without opening the form, clicking
the next record, then clicking the button - then clicking the next
record, then clicking the next button etc...
the code i'm using is as follows...
Private Sub Command12_Click()
' new code...
' vartext(6) and vartext(7)
Dim incorporationdate As Integer
Dim countryoforigin As Integer
Dim typeofbusiness As Integer
Dim natureofbusiness As Integer
Dim referencedate As Integer
Dim accountsmadeupto As Integer
Dim accountsdue As Integer
Dim accountsreturn As Integer
Dim explanationofbusiness As Integer
varText = Split(copieddata, vbCrLf)
Me.Company_Name.Value = varText(0)
Me.address1.Value = varText(1)
Me.address2.Value = varText(2)
Me.address3.Value = varText(3)
Me.address4.Value = varText(4)
companynumber = varText(5) ' assign the fifth line to the
variable stringcompanynumber
companyinteger = Mid(companynumber, 13) ' assign the 'number' out of
stringcompanynumber to companynumber
Me.Company_Reg_No.Value = companyinteger ' insert companynumber
into 'company reg no' field.
For intloop = 6 To 10
incorporationdate = intloop + 1
countryoforigin = intloop + 3
typeofbusiness = intloop + 5
natureofbusiness = intloop + 6
explanationofbusiness = intloop + 7
If Len(Trim(varText(intloop) & "")) > 0 Then
Me.status.Value = Mid(varText(intloop), 9)
Me.Date_of_Incorporation.Value = Mid(varText(incorporationdate), 25)
Me.biztype.Value = varText(typeofbusiness)
Me.[SIC Explanation].Value = varText(explanationofbusiness)
Me.Refresh
End
' varText(intLoop) contains a value
Else
' varText(intLoop) doesn't contain a value
End If
Next intloop
Thanks for your help,
Gary-