Opening another form based on info in current form

  • Thread starter Thread starter Ted
  • Start date Start date
T

Ted

I am trying to open a alert form if a CategoryID is equal
to "C" (which is populated in a combo box in the form i'm
working in) I can't get it to work. Please look at this
code and tell me which direction I should head.

Private Sub Form_Current()
Dim stDocNameTed As String
stDocNameTed = "ArtHoldFrm"
If CategoryID.Value = "C" Then //problem
DoCmd.OpenForm stDocNameTed
End If
End Sub
Thanks,
Ted
 
Ted said:
I am trying to open a alert form if a CategoryID is equal
to "C" (which is populated in a combo box in the form i'm
working in) I can't get it to work. Please look at this
code and tell me which direction I should head.

Private Sub Form_Current()
Dim stDocNameTed As String
stDocNameTed = "ArtHoldFrm"
If CategoryID.Value = "C" Then //problem
DoCmd.OpenForm stDocNameTed
End If
End Sub

Your code looks fine.

Is it possible that the ComboBox has multiple columns and while you "see" a
"C", the bound column actually has a different value?
 
Another approach, button on form with macro attached to activate on click
Condition Actio
[fieldthathasthevalue]="value" Open Repor

at the bottom of macro scree
Report name= the report you want to ope
View=print previe
Filter Name=none or whatever you wan
Where condition=[fieldthathasthevalue]=[forms]![nameofformorreport]![fieldthathasthevalue
You may apply several conditions. Hope this helps
 
-----Original Message-----


Your code looks fine.

Is it possible that the ComboBox has multiple columns and while you "see" a
"C", the bound column actually has a different value?


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
Thanks, turns out it shows C but is stored lowercase so I
will capture and capitalize first.
 
Back
Top