Sorting Form Like Reports Wizard

razaqad

Raza
Local time
Today, 10:41
Joined
Mar 12, 2006
Messages
83
I want to make an unbound form that has the functionality like the form found in access for reports wizard.

I want the user to be able to select the sort order dynamically for a report instead of a fixed sort order. But i'am unable to sort out my own problem :mad:

plz check out the functionality of this form by opening in your access.



When the first combo is empty all the other combo boxes are disabled.

Entering something in the top combo enables the combo below it.

If we delete something in the top combo when something is already existing in the combo beolw it, the values of the bottom combo boxes are shifted to the upeer combos and the lower combos are disabled.

i have also attached the picture for refference.
 

Attachments

  • sorting.GIF
    sorting.GIF
    14.2 KB · Views: 171
I have not tried it out, but it must be something like:-

on afterupdate event check for data
if data found then make sure box below is enabled.
if no data found
check box below for data, if found copy to self and delete from box below, run after update event for box below
If no data found in box below then make sure that box below is not enabled.

Hope that makes sense :)

Peter
 
Bat17 said:
I have not tried it out, but it must be something like:-

on afterupdate event check for data
if data found then make sure box below is enabled.
if no data found
check box below for data, if found copy to self and delete from box below, run after update event for box below
If no data found in box below then make sure that box below is not enabled.

Hope that makes sense :)

Peter

Thanks Peter.
It worked. U gave me the logic and i cpmleted the rest.

on afterupdate event check for data
if data found then make sure box below is enabled.
if no data found
check box below for data, if found copy to self and delete from box below, run after update event for box below
If no data found in box below then make sure that box below is not enabled. AND ENABLE THE BOX ABOVE.


Private Sub Combo1_AfterUpdate()
If Len(Me.Combo1) <> 0 Then
Me.Combo2.Enabled = True
Else
Me.Combo1 = Me.Combo2
Me.Combo2 = Null
Me.Combo2.Enabled = False
End If

If Len(Me.Combo1) <> 0 Then
Me.Combo2.Enabled = True
Else
Me.Combo1 = Me.Combo2
Me.Combo2 = Null
Me.Combo2.Enabled = False
End If

Combo2_AfterUpdate
End Sub

Private Sub Combo2_AfterUpdate()
If Len(Me.Combo2) <> 0 Then
Me.Combo3.Enabled = True
Else
Me.Combo2 = Me.Combo3
Me.Combo3 = Null
Me.Combo3.Enabled = False
End If

If Len(Me.Combo2) <> 0 Then
Me.Combo3.Enabled = True
Else
Me.Combo2 = Me.Combo3
Me.Combo3 = Null
Me.Combo3.Enabled = False
End If

Combo3_AfterUpdate
End Sub

Private Sub Combo3_AfterUpdate()
If Len(Me.Combo3) <> 0 Then
Me.Combo4.Enabled = True
Else
Me.Combo3 = Me.Combo4
Me.Combo4 = Null
Me.Combo4.Enabled = False
End If

If Len(Me.Combo3) <> 0 Then
Me.Combo4.Enabled = True
Else
Me.Combo3 = Me.Combo4
Me.Combo4 = Null
Me.Combo4.Enabled = False
End If
End Sub
 
Glad you have it working :)
I don't think you need to repeat the If's each time though, and for saftey you may wan't to use
If Len(NZ(Me.Combo3,""))<> 0 Then


But if you have tested it and it works then its good :)

Peter

Peter
 
If Len(NZ(Me.Combo3,""))<> 0 Then that a good option.

if's are repeated because:

1)suppose i have selected values for all four combos
2)after selecting the value i set combo 1 to null
3)
If Len(Me.Combo1) <> 0 Then
Me.Combo2.Enabled = True
Else
Me.Combo1 = Me.Combo2
Me.Combo2 = Null
Me.Combo2.Enabled = False
End If

not that now combo 2's value is compied to combo 1 and combo 2's value is set to null and it is disabled. And afterupdate of combo 2 is called

4)

If Len(Me.Combo2) <> 0 Then
Me.Combo3.Enabled = True
Else
Me.Combo2 = Me.Combo3
Me.Combo3 = Null
Me.Combo3.Enabled = False
End If

now as the combo 2 has null value so combo 2 is assigned combo 2's value but it is not enabled.

So the problem is that all the combos after combo1 are disabled.



Thats why i have repeated the if's
 

Users who are viewing this thread

Back
Top Bottom