A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

OpenForm Macro



 
 
Thread Tools Display Modes
  #1  
Old May 21st, 2010, 06:17 PM posted to microsoft.public.access
dirtrhoads
external usenet poster
 
Posts: 15
Default OpenForm Macro

I have set up an OpenForm macro on a double click event in a subform. The
subform is titled Active Orders at Belmont Subform. The form I have set to
open is Order Details. I have set up the macro to open Order Details when I
click on the PO_Number from my subform and it opens perfect, however, I want
it to open up to the record I double clicked. As of right now, it is opening
up to the first record. I tried typing in PO_Number in the WHERE clause but
this caused the event to open up to a New Record...

Can you please let me know what I need to do in order to have this open up
to the selected record?

Thank you,
Amy
  #2  
Old May 21st, 2010, 08:50 PM posted to microsoft.public.access
Wolfgang Kais[_4_]
external usenet poster
 
Posts: 18
Default OpenForm Macro

Hello Amy.

"dirtrhoads" (Amy) wrote:
I have set up an OpenForm macro on a double click event in a subform.
The subform is titled Active Orders at Belmont Subform. The form I
have set to open is Order Details. I have set up the macro to open
Order Details when I click on the PO_Number from my subform and it
opens perfect, however, I want it to open up to the record I double
clicked. As of right now, it is opening up to the first record.
I tried typing in PO_Number in the WHERE clause but this caused the
event to open up to a New Record...


The WHERE clause sould have the form "PO_Number = 123". Since the number
depends on a field of the current record, this WHERE clause has to be
calculated. Try something like this in the argument:
="PO_Number = " & [PO_Number]

--
Regards,
Wolfgang


  #3  
Old May 22nd, 2010, 05:58 PM posted to microsoft.public.access
dirtrhoads
external usenet poster
 
Posts: 15
Default OpenForm Macro

Wolfgang,

Thank you for your suggestion, but unfortunately that didn't work. When it
entered it exactly as you had it it gave me an error that says "You may have
specified a control that wasn't on the current object without specifying the
correct form or report context". So I entered this into the WHERE clause:

="PO_Number = " & [Forms]![Order Details]![PO_Number]

but this gave me another error stating that form i referenced was either
closed or did not exist.

So, i opened the form, minimized it and then ran the macro again and it
asked me for a parameter and I'm assuming this is because my PO Numbers are
alpha numeric...?

I'd like to be able to double click the PO Number from subform without
having to have Order Details open/minimized, and also not to have to enter
the Alpha parameter... will this be possible?

Thanks you,
Amy

"Wolfgang Kais" wrote:

Hello Amy.

"dirtrhoads" (Amy) wrote:
I have set up an OpenForm macro on a double click event in a subform.
The subform is titled Active Orders at Belmont Subform. The form I
have set to open is Order Details. I have set up the macro to open
Order Details when I click on the PO_Number from my subform and it
opens perfect, however, I want it to open up to the record I double
clicked. As of right now, it is opening up to the first record.
I tried typing in PO_Number in the WHERE clause but this caused the
event to open up to a New Record...


The WHERE clause sould have the form "PO_Number = 123". Since the number
depends on a field of the current record, this WHERE clause has to be
calculated. Try something like this in the argument:
="PO_Number = " & [PO_Number]

--
Regards,
Wolfgang


.

  #4  
Old May 23rd, 2010, 10:53 AM posted to microsoft.public.access
Wolfgang Kais[_4_]
external usenet poster
 
Posts: 18
Default OpenForm Macro

Hello Amy.

"dirtrhoads" (Amy) wrote:
I have set up an OpenForm macro on a double click event in a subform.
The subform is titled Active Orders at Belmont Subform. The form I
have set to open is Order Details. I have set up the macro to open
Order Details when I click on the PO_Number from my subform and it
opens perfect, however, I want it to open up to the record I double
clicked. As of right now, it is opening up to the first record.
I tried typing in PO_Number in the WHERE clause but this caused the
event to open up to a New Record...


Wolfgang answered:
The WHERE clause sould have the form "PO_Number = 123". Since the
number depends on a field of the current record, this WHERE clause has
to be calculated. Try something like this in the argument:
="PO_Number = " & [PO_Number]


"dirtrhoads" came back:
Wolfgang,

Thank you for your suggestion, but unfortunately that didn't work. When
I entered it exactly as you had it it gave me an error that says "You
may have specified a control that wasn't on the current object without
specifying the correct form or report context".


Try replacing the name in [PO_Number] by the correct name of the
corresponding control on the subform.

So I entered this into the WHERE clause:

="PO_Number = " & [Forms]![Order Details]![PO_Number]

but this gave me another error stating that form i referenced was
either closed or did not exist.


Here, you have referenced a control on the form that you were going to
open. You should have referenced the control on the subform that contains
the PO_Number that you want to use in the WHERE clause.

So, i opened the form, minimized it and then ran the macro again and it
asked me for a parameter and I'm assuming this is because my PO Numbers
are alpha numeric...?


I don't think so, but probably the record sorce for the Order Details form
does not contain a field named PO_Number. Verify the name of the field and
correct the first part of the WHERE clause argument:
="[correct field name] = " & ...
Since your field seems to be of type text, try the following:
="[correct field name] = '" & [correct control name] & "'"

I'd like to be able to double click the PO Number from subform without
having to have Order Details open/minimized, and also not to have to
enter the Alpha parameter... will this be possible?


Sure. Try my suggestions and the we'll see. If this dosn't work either,
try to replace [correct control name] by the complete path to the control:
[Forms]![name of main form]![name of subform control].Form![correct control
name]

--
Regards,
Wolfgang


  #5  
Old May 30th, 2010, 03:06 AM posted to microsoft.public.access
Endo
external usenet poster
 
Posts: 2
Default OpenForm Macro


"dirtrhoads" wrote in message
...
I have set up an OpenForm macro on a double click event in a subform. The
subform is titled Active Orders at Belmont Subform. The form I have set to
open is Order Details. I have set up the macro to open Order Details when
I
click on the PO_Number from my subform and it opens perfect, however, I
want
it to open up to the record I double clicked. As of right now, it is
opening
up to the first record. I tried typing in PO_Number in the WHERE clause
but
this caused the event to open up to a New Record...

Can you please let me know what I need to do in order to have this open up
to the selected record?

Thank you,
Amy


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.