Select Case of If Then Statement

Mahoney

Registered User.
Local time
Today, 00:02
Joined
Feb 4, 2009
Messages
28
Hello,

I dont know if i am correct, but i am writing a Select Case statement or and if then statement, but it does not seem to work if the source type is a table/query type? if so, is there a way the select case can work if the while keeping it in a table/query row source type?

many thanks
 
Huh??? :confused: I'm sorry but I couldn't resist. :p How about maybe showing us some code so we can see what you are trying to accomplish? Or maybe just describe it differently for us (me :o).
 
hello

I have a combo box (DispatchMethod) that has a row source type of Table/Query, which is linked to a table called courier companies, and i can select FedEx, Aramex, UPS, Email, Satellite
I want 2 field boxes, which are AWB & Tape Format to be disabled when I choose email and only AWB to be disabled when I choose satellite.

This is not working , where nothing get disabled after writing the follow code;


Private Sub DispatchBy_AfterUpdate()
Select Case DispatchBy
Case "Email"
Me.AWB.Enabled = False
Me.TapeFormat.Enabled = False
Case "Sattelite"
Me.AWB.Enabled = False
Me.TapeFormat.Enabled = True
Case "FedEx", "Aramex", "DHL"
Me.AWB.Enabled = True
Me.TapeFormat.Enabled = True
End Select
End Sub

However on a diffrent data base, where the combo box DispatchMethod is has a row source type of value list, the same code works perfectly, so i assume that it is not working on the first database because of the row source type, but i am sure that there should be a way where it will work by keeping the row source tyupe to table/query

many thanks
 
I assume the DispatchBy control is a ComboBox. What is the SQL of the RowSource for this cbo and to what is the Bound Column set?
 
yes it is a combox, the row source is; SELECT [tblCourierCompanies].[CourierCompanyID], [tblCourierCompanies].[CourierCompany] FROM tblCourierCompanies ORDER BY [CourierCompany];

The Bound Column is set to 1

thanks
 
Try the following:
Code:
Private Sub DispatchBy_AfterUpdate()
   Select Case [B][COLOR="Red"]Me.DispatchBy.Column(1)[/COLOR][/B]
      Case "Email"
         Me.AWB.Enabled = False
         Me.TapeFormat.Enabled = False
      Case "Sattelite"
         Me.AWB.Enabled = False
         Me.TapeFormat.Enabled = True
      Case "FedEx", "Aramex", "DHL"
         Me.AWB.Enabled = True
         Me.TapeFormat.Enabled = True
   End Select
End Sub
 
Many thanks Ruralguy

I tried this and it worked perfectly

many thanks again
 

Users who are viewing this thread

Back
Top Bottom