OpenForm command

D

Dan Cole

I have an unbound textbox on my main switchboard named
OrderLookUp. I have the AfterUpdate event set to a macro
called OrderLookUp, which has the action OpenForm, Form
Name is Orders, Where Condition is [Forms]![Orders]!
[OrderID]=[Forms]![Main Switchboard]![OrderLookUp].
However, when I enter a value into OrderLookUp, it runs
the macro and opens the form called Orders, but it's a
blank form, even though the value I entered definetely
corresponds to a value on the form Orders.

Basically, I want to be able to enter an order number on
the main switchboard, hit enter, and have the database
open the order form to that particular order. What am I
doing wrong? Thanks.
 
A

Albert D. Kallal

Where Condition is [Forms]![Orders]!
[OrderID]=[Forms]![Main Switchboard]![OrderLookUp].

Your problem is that the were condition wants you to enter a field name..and
NOT a form name!

So,

you where condition needs to be "some field from the table = some value" You
can try:

dim strWhere as string

strWhere = "OrderID = " & me.OrderLookUp

docmd.OpenForm "Orders",,,strWhere
 
R

Reggie

Is OrderLookUp on your switchboard a combo box? If so make sure the bound
column is the OrderID column in the combo box. Now change your macro to:

[OrderID]=[Forms]![Main Switchboard]![OrderLookUp]

--
Reggie

www.smittysinet.com
----------
Albert D. Kallal said:
Where Condition is [Forms]![Orders]!
[OrderID]=[Forms]![Main Switchboard]![OrderLookUp].

Your problem is that the were condition wants you to enter a field name..and
NOT a form name!

So,

you where condition needs to be "some field from the table = some value" You
can try:

dim strWhere as string

strWhere = "OrderID = " & me.OrderLookUp

docmd.OpenForm "Orders",,,strWhere


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn
 

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