Open Form

Open Form

Post by Gee » Sat, 06 Mar 2004 07:33:51


My code is at the bottom....
When I click on Command328 I go from "Steps Form"
to "Steps MISC Form" just like I need to.
My problem is that rather than go to the record that I'm
on in Steps Form, it goes to the first record. I have a
control called "Unique ID" that is in both. How do I get
it to jump to the "Steps MISC Form" that has a
matching "Unique ID"?
(I know this is gonna be simple and I'm gonna feel like a
dope}
Thanks in advance for your help!

Private Sub Command328_Click()
On Error GoTo Err_Command328_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Steps MISC Form"
DoCmd.OpenForm stDocName, , stLinkCriteria


Exit_Command328_Click:
Exit Sub

Err_Command328_Click:
MsgBox Err.Description
Resume Exit_Command328_Click

End Sub
 
 
 

Open Form

Post by Graham R S » Sat, 06 Mar 2004 08:45:44


stLinkCriteria = "[Unique ID] = " & Me![Unique ID] '*****
DoCmd.OpenForm stDocName, , stLinkCriteria

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

 
 
 

Open Form

Post by Gee » Sun, 07 Mar 2004 01:32:37

That didn't quite work. It sent me to the right form, but
not to the same ID. It sent me to a new form.

ID] '*****
message

get
a
 
 
 

Open Form

Post by Graham R S » Tue, 09 Mar 2004 07:15:01

Then you need to rename [Unique ID] to whatever your primary key name is.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
 
 

Open Form

Post by Bernd Smit » Wed, 08 Sep 2004 04:52:48

Hello,
if I've created a "research for name" with a combobox, how can I, when I
double-click on a select name, open a form with the information about the
selected person?
Thanks
Bernd
 
 
 

Open Form

Post by Dan Artus » Wed, 08 Sep 2004 05:25:42

Hi,
First, usually you have the PersonId field (or whatever you called it) as the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.
 
 
 

Open Form

Post by Bernd Smit » Thu, 09 Sep 2004 05:37:14

Hi,
So:
1) I create a combobox bound to a column in a table;
2) I create a form that contains all the fields that are present in the same
table;
3) But finally do I have to add the commandline you've wrote? And last part
of the commandline is Me.cboPerson or do I have to replace it with something
else?
Thanks
Bernd

Hi,
First, usually you have the PersonId field (or whatever you called it) as
the bound column
of your combo.
Now, you design a form that pulls ALL the records.
You then use the OpenForm method utilizing the WhereCondition argument to
only display the info on the selected person:

DoCmd.OpenForm "yourForm",,,"PersonId = & Me.cboPerson

Substitute your form, control and field names.
 
 
 

Open Form

Post by fred » Thu, 09 Sep 2004 07:40:10


As you have started a new thread with this message, I can only guess
you wish to open a form filtered to the record whose ID matches the
value in the combo box.

As written there is a missing quote in the suggested Where clause.
The entire line should read:
DoCmd.OpenForm "yourForm",,,"[PersonId] = " & Me![cboPerson]

Change "yourForm" to the actual name of the form you wish to open.
Change "cboPerson" to the actual name of the combo box.
Change "PersonID" to the actual name of the Unique prime key field in
the table of the form being opened.

The above assumes [PersonID] is a number datatype field.
If [PersonID] is Text datatype, use:

DoCmd.OpenForm "yourForm",,,"[PersonId] = '" & Me![cboPerson] & "'"

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
 
 

Open Form

Post by fred » Thu, 09 Sep 2004 07:42:58


I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
 
 

Open Form

Post by Bernd Smit » Fri, 10 Sep 2004 07:17:17

Hi,
my question is now: where do I have to insert the command 'DoCmd.OpenForm
"yourForm",,,"[PersonId] = " & Me![cboPerson]'
exactly?
Thanks
Bernd

"fredg" < XXXX@XXXXX.COM > ha scritto nel messaggio


same
part
something
as
to
 
 
 

Open Form

Post by fred » Fri, 10 Sep 2004 08:41:09


I answered this in a follow-up to my post.

"I forgot to add, you would write the OpenForm command in the either
the cboPerson AfterUpdate event or in a Command button Click event."
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
 
 

Open Form

Post by Bernd Smit » Fri, 10 Sep 2004 18:59:29

i,
ok I done it. But I have still a few questions:
1) I would like to double-click before the relative for is open, but now the
form opens directly just when I click one time. How to do?;
2) I would like that the form opens on the same form as the combobox,
exactly I want that the form opens below the combobox. How can I do that?
With the clause "where"?
3) I would like that when I'm writing (first, second, etc. letter) of the
name of the person that I'm searching about, there opens below the combobox,
istantly a list of the names that begins with letter that I have typed. How
can I do that?.
Thanks
Bernd
"fredg" < XXXX@XXXXX.COM > ha scritto nel messaggio
news: XXXX@XXXXX.COM ...
'DoCmd.OpenForm
the


 
 
 

Open Form

Post by fred » Sat, 11 Sep 2004 00:37:22

n Thu, 9 Sep 2004 11:59:29 +0200, Bernd Smits wrote:


If you wish the form to open on double-clicking the combo box, then
place the code to open the form in the Combo Box's Double-click event,
not the click event.


You could pass the opening position to the form using the OpenForm
OpenArgs argument:

DoCmd.OpenForm "FormName", , , , , , Me!ComboName.Left & "," &
Me.ComboName.Top + Me!ComboName.Height + Me.FormHeader.Height + 1440

You'll need to adjust the above, depending upon if you have a form
header and exactly where you wish the form to open.
Note: The measurements are in Twips; 1440 Twips = 1 inch.

Then code the Load event of the form being opened:

If Not IsNull(Me.OpenArgs) Then
DoCmd.MoveSize Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1),
Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
End If

You'll also want to set this form's PopUp property to Yes.


I'm not wholly sure of what you want here.
The above is normal combo box behavior if you set the combo AutoExpand
property to Yes.
Or do you also wish to set the combo box to dropdown on enter. In that
case, code the Combo Box Enter event:
Me!ComboName.Dropdown




--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
 
 
 

Open Form

Post by David » Sun, 03 Apr 2005 02:48:00

I have got an issue with an mda/mde form.
Everything works fine on my pc, but when I install the mde(have tried the
mda also) on another pc I get the problem of ,
I have got a few forms that open another form to show the detail of the main
record. When I open any of the forms that open from another form ,I get a
blank record.

Before I was using
DoCmd.OpenForm "cview", , , "[po] = [Forms]![po1].[ppo1]![po]"
to open the second form

This morning I went back and changed it to
Docmd.OpenForm "cview"
Forms.cpurchase.Filter = "[po] = [Forms]![po1].[ppo1]![po]"
Forms.cpurchase.FilterOn = True
to open the second form

A little while ago, I changed to a query for the forms filter and used
criteria from the main form to set the query by. I used
Docmd.openform "cview"
forms!cview.recordsoucre = "myquery"
to open the second form

None of these will work on other pc's, but I have no problem on mine.
It is all of the forms that use a second popup to show any information

Can someone point me in the right direction?
 
 
 

Open Form

Post by TWFydml » Sun, 03 Apr 2005 04:19:04

If the commands you showed work on your PC and the other PCs are running the
same version of Access, I don't see why they wouldn't be working the same.

I would check:
1. Does the form, cview, open properly filtered if you copy and paste the
filter into the filter property? (Is the form on your PC saved with a filter?
Maybe the form appears to be opening properly because it is saved with the
filter you want it to have. If the syntax of the filter you pass to a form is
not correct, it may ignore it and use the filter with which it was saved.)
2. Check the double quotes and exclamation points on your filter. See if the
syntax works when you enter them directly into the filter property of cview.
I don't remember off hand, but maybe you can try the
"forms('FromName').Controlname..." format in the filter property.
3. Perhaps there is actually a runtime error that is keeping the form from
filtering that is not related to the filter.
4. If none of this works, you can try passing the value for the control to
cview, e.g. Forms.cpurchase.Filter = "[po] = " & [po].Value

Marvin