Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF question

Status
Not open for further replies.

edgarchado

Technical User
Apr 5, 2005
59
AR
Hi,

I Have the following code. Tha idea is that if tblPedido.Anulado is equal to False (Anulado is has a Yes/no type) when I double click a line in a listbox it will open a form. This listbox is populated by a search function. I need to open two different forms depending on the information stored in the anulado field (True or false).

The Docmd Event works when there is no If statement. What should I do so it works with the if?

Thanks in advance.

Private Sub lstPedido_DblClick(Cancel As Integer)
If tblPedido.Anulado = False Then
DoCmd.OpenForm "frmVisualizarPedido", , , "[N°_de_Pedido] = " & Me.lstPedido, acFormReadOnly, acDialog
Else
DoCmd.OpenForm "frmVisualizar_Pedido_Anulado", , , "[N°_de_Pedido] = " & Me.lstPedido, acFormReadOnly, acDialog
End If
End Sub
 
Replace this field name (tblPedido.Anulado) by the corresponding control name.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH,

The control name would be lstPedido. The problem is that this is a listbox with 4 columns, and I need to refer to the column Anulado.

Is this possible?
 
Yes, you should be able to do
lstListbox.Column(x) where x is the column Anulado
or if Anulado is the bound column to that list box just use lstListbox.

Ascent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top