vba question

  • Thread starter Thread starter Norman Fritag
  • Start date Start date
N

Norman Fritag

Hi there

I have there a situation whereas I want to evaluate behind a form, what the
change for a range was.
The Range is set as txtRangeFrom and to txtRangeTo. Maximum range is 0 to
12.

Now the use wants to make all kinds of changes to the range, which can vary
from eg: 7 - 9, 0 - 6, 0 - 6.
I have 3 default ranges 0 - 12, 7 - 12, 0 - 6.
The Ranges are related to a the table Issues as one to many relation ship,
on issues has a range category from to, which is set on this form. I would
have to check as well if for the desired range changes request, data against
this record were entered or not and than flag appropriate actions. ( the
later part is resolved)

the answer I looking for is to know how I could specifically tell, what
changes were made (is resolved ) and what parts / items/data of the range, I
would have to add or delete from the control table?

eg1: if the range was 0 - 11 >>> 0,1,2,3,4,5,6,7,8,9,10,11
New range required 7 - 9, meaning that 0 - 6 related and 10 - 11
record from the control table would need to be deleted . New range =
7,8,9
eg2: if the range was 7 - 9 >>> 7,8,9
new range required 0 - 7, Meaning 0 - 6 would need to be added,
8 - 9 to be deleted from the control table.
New range is 0,1,2,3,4,5,6,7
eg3: if the range was 0 - 7 >>> 0,1,2,3,4,5,6,7
new range required 4 - 9, Meaning 8 - 9 would need to be added,
0 - 3 would need to be deleted from the control table. New range is
4,5,6,7,8,9

the scenarios could go on and on....

I was thinking of reading the range into and array and than compare the 2
range with the result to say what numbers are there to keep, what numbers
are not there to add and those number that are to much to delete, ( I words)
but is have very few experience working with arrays.

eg:
'to delete from controle table

For intx = Me.txtRangefrom.OldValue To Me.txtrangeto.OldValue

strOldRange = strOldRange & intx & ", "

Next intx



For intx = Me.txtRangefrom To Me.txtRangesto

StrNewRange = strNewRange & intx & ", "

Next intx



'array evaluation goes here

??



intfrom = Int(StrNewRangefrom) '

intNewto = Int(StrNewRangeto)

'to add to controle table
For intx = Me.txtRangefrom.OldValue To Me.txtrangeto.OldValue

strOldRange = strOldRange & intx & ", "

Next intx



For intx = Me.txtRangefrom To Me.txtRangesto

StrNewRange = strNewRange & intx & ", "

Next intx



'array evaluation goes here

??



intfrom = Int(StrNewRangefrom) '

intNewto = Int(StrNewRangeto)



any hint or help is very much appreciated.

Regards
Norman
 
You can build a list and from the list a filte

Dim i as intege
Dim sList as strin
Dim sqlWhere as strin

'Check for legit vals in both low & high val
sList=me.txtLo
For i=me.txtLow+1 to Me.txtHig
sList = sList &";" &str(i
Nex
sqlWhere = "[<fieldname> in (" &sList &")

Now apply the sqlWhere as the filter
If the Year Levels (I assume that's what they are) are string values it's a bit more messy as the list will have to contain string values eg ("2";"3";"4") rather than (2;3;4

HTH
Terr
----- Norman Fritag wrote: ----

Hi ther

I have there a situation whereas I want to evaluate behind a form, what th
change for a range was
The Range is set as txtRangeFrom and to txtRangeTo. Maximum range is 0 t
12

Now the use wants to make all kinds of changes to the range, which can var
from eg: 7 - 9, 0 - 6, 0 - 6
I have 3 default ranges 0 - 12, 7 - 12, 0 - 6
The Ranges are related to a the table Issues as one to many relation ship
on issues has a range category from to, which is set on this form. I woul
have to check as well if for the desired range changes request, data agains
this record were entered or not and than flag appropriate actions. ( th
later part is resolved

the answer I looking for is to know how I could specifically tell, wha
changes were made (is resolved ) and what parts / items/data of the range,
would have to add or delete from the control table

eg1: if the range was 0 - 11 >>> 0,1,2,3,4,5,6,7,8,9,10,1
New range required 7 - 9, meaning that 0 - 6 related and 10 - 1
record from the control table would need to be deleted . New range
7,8,
eg2: if the range was 7 - 9 >>> 7,8,
new range required 0 - 7, Meaning 0 - 6 would need to be added
8 - 9 to be deleted from the control table
New range is 0,1,2,3,4,5,6,
eg3: if the range was 0 - 7 >>> 0,1,2,3,4,5,6,
new range required 4 - 9, Meaning 8 - 9 would need to be added
0 - 3 would need to be deleted from the control table. New range i
4,5,6,7,8,

the scenarios could go on and on...

I was thinking of reading the range into and array and than compare the
range with the result to say what numbers are there to keep, what number
are not there to add and those number that are to much to delete, ( I words
but is have very few experience working with arrays

eg
'to delete from controle tabl

For intx = Me.txtRangefrom.OldValue To Me.txtrangeto.OldValu

strOldRange = strOldRange & intx & ",

Next int



For intx = Me.txtRangefrom To Me.txtRangest

StrNewRange = strNewRange & intx & ",

Next int



'array evaluation goes her

?



intfrom = Int(StrNewRangefrom)

intNewto = Int(StrNewRangeto

'to add to controle tabl
For intx = Me.txtRangefrom.OldValue To Me.txtrangeto.OldValu

strOldRange = strOldRange & intx & ",

Next int



For intx = Me.txtRangefrom To Me.txtRangest

StrNewRange = strNewRange & intx & ",

Next int



'array evaluation goes her

?



intfrom = Int(StrNewRangefrom)

intNewto = Int(StrNewRangeto



any hint or help is very much appreciated

Regard
Norma
 
Back
Top