Opening another form based on info in current form

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
 
R

Rick Brandt

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?
 
G

Guest

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
 
T

Ted

-----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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top