G
Gary
I would like to evaluate the variable vartext(4) to see if the variable
is a blank line, now i know a 'blank line' has a number of definitions,
so i'll outline what i'm doing quickly so you know exactly what i mean.
Im copying data from the clipboard into a control called 'copied data'.
then I'm splitting that data up into useful chunks, i'll give you an
example.
this is an example of pasted data into the control 'copied data' : -
"
COMPANY NAME
ADD1
ADD2
ADD3
POSTCODE
Company No. 1234567
' just some spaces here ...
' totally blank line'
' just some more spaces here ...
DATE OPENED
DATE CLOSED
"
I am using the following code to extract the company name, company
number and address details from this data and put it into the correct
fields in the database, Which works fine: -
Private Sub Command12_Click()
Dim companyinteger As Variant
Dim companynumber As Variant
' split the copied data field, assigning each line to its own variable.
' extract the company number into the company number field.
varText = Split(copieddata, vbCrLf)
' assign the fifth line to the variable stringcompanynumber
companynumber = varText(5)
' assign the 'number' out of stringcompanynumber to companynumber
companyinteger = Mid(companynumber, 13)
' insert companynumber into 'company reg no' field.
Me.Company_Reg_No.Value = companyinteger
' extract the company name into the companyname field.
companyname = varText(0)
Me.Company_Name.Value = companyname
' put the address data into seperate address line fields.
Me.address1.Value = varText(1)
Me.address2.Value = varText(2)
Me.address3.Value = varText(3)
Me.address4.Value = varText(4)
End Sub
... I now need to extract the 'date opened' and 'date closed' info to
and put each into it's respective field in the database in the same
way. However the problem is that there are an indefinate number of
blank lines, or lines with some spaces and nothing else between the
company number field and the date opened field.
So I want to check each vartext line after, the last address line, to
see if it actually isn't empty and doesn't just contain spaces. If it
is empty or just contains spaces I want to ignore it and move to the
next line, if however it has some data i will know that this will be
the 'date opened' data, and the next line will be 'date closed' so i
can extract the useful data from these two lines and put into the right
fields.
I hope i've made sense, please help - as i'm close but not quite there
yet...
thanks,
Gary.
is a blank line, now i know a 'blank line' has a number of definitions,
so i'll outline what i'm doing quickly so you know exactly what i mean.
Im copying data from the clipboard into a control called 'copied data'.
then I'm splitting that data up into useful chunks, i'll give you an
example.
this is an example of pasted data into the control 'copied data' : -
"
COMPANY NAME
ADD1
ADD2
ADD3
POSTCODE
Company No. 1234567
' just some spaces here ...
' totally blank line'
' just some more spaces here ...
DATE OPENED
DATE CLOSED
"
I am using the following code to extract the company name, company
number and address details from this data and put it into the correct
fields in the database, Which works fine: -
Private Sub Command12_Click()
Dim companyinteger As Variant
Dim companynumber As Variant
' split the copied data field, assigning each line to its own variable.
' extract the company number into the company number field.
varText = Split(copieddata, vbCrLf)
' assign the fifth line to the variable stringcompanynumber
companynumber = varText(5)
' assign the 'number' out of stringcompanynumber to companynumber
companyinteger = Mid(companynumber, 13)
' insert companynumber into 'company reg no' field.
Me.Company_Reg_No.Value = companyinteger
' extract the company name into the companyname field.
companyname = varText(0)
Me.Company_Name.Value = companyname
' put the address data into seperate address line fields.
Me.address1.Value = varText(1)
Me.address2.Value = varText(2)
Me.address3.Value = varText(3)
Me.address4.Value = varText(4)
End Sub
... I now need to extract the 'date opened' and 'date closed' info to
and put each into it's respective field in the database in the same
way. However the problem is that there are an indefinate number of
blank lines, or lines with some spaces and nothing else between the
company number field and the date opened field.
So I want to check each vartext line after, the last address line, to
see if it actually isn't empty and doesn't just contain spaces. If it
is empty or just contains spaces I want to ignore it and move to the
next line, if however it has some data i will know that this will be
the 'date opened' data, and the next line will be 'date closed' so i
can extract the useful data from these two lines and put into the right
fields.
I hope i've made sense, please help - as i'm close but not quite there
yet...
thanks,
Gary.