Pop Up Forms

P

PHisaw

I have a combo field "WorkCode" on a subform "fWorkLog" on a main form
"fGeneralInfo" that has a list to choose from such as "Receiving" "Shipping".
I need popup form "fPopUpReceiving" to display when "Receiving" is chosen
in this combo box. If shipping is chosen, popup form "fPopUpShipping" will
display. I've tried different codes and can't seem to make anything work
properly. I either get ALL the forms to open no matter what I select or
NOTHING to open.
Any help is greatly appreciated!
PHisaw
 
T

tina

try adding the following code to the combo box control's AfterUpdate event,
as

If Me!ComboboxName = "Receiving" Then
DoCmd.OpenForm "fPopUpReceiving"
ElseIf Me!ComboboxName = "Shipping" Then
DoCmd.OpenForm "fPopUpShipping"
End If

hth
 
P

Pam

Are there supposed to be any spaces between If and Me? I tried it with
spaces and it returned nothing when I selected a choice from drop down. I
basically had tried the same thing but had quotes around the combo name -
"Me.ComboBoxName" = Receiving Then

and this returned nothing also. Is there a difference between your statement
and the one I used? I'm trying to get a handle on some of the codes and how
to apply them. I tried without spaces and it gave compile error msg
"expected end of statement". I really appreciate your help with this!
 
T

tina

Are there supposed to be any spaces between If and Me?

yes, one space. the syntax i posted is correct. i suspect that the problem
is with the value of the combo box. open your form in design view, click on
the combo box control to select it, copy the entire RowSource (NOT the
ControlSource) property, and paste it into a post so we can see it. also,
post what is the setting of the combo box control's ColumnCount property and
the BoundColumn property.

hth
 
P

Pam

Tina,
I took your msg and looked at some other posts about combo columns and added
to what you previously gave me and it worked!!
Here is the row source for the combo box
SELECT tLookupWorkCodes.WorkCodeID, tLookupWorkCodes.WorkCode FROM
tLookupWorkCodes;
the column count is 2 and the bound column is 1
I entered
If Me!ComboboxName.Column(1) = "Receiving" Then
DoCmd.OpenForm "fPopUpReceiving"
I think this is the last thing I have to do to get this db to start working!
Thank you again for your wonderful help!!! Very much appreciated!!
Pam
 

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

Similar Threads


Top