Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 27th, 2007, 01:25 PM
njandtmp@gmail.com
Guest
 
Posts: n/a
Default Form Lookup

Hi,
I am trying to pass a form lookup that is built in code. I will give
an example below.
Truncated to only show the relevent information.

Dim PDate as String
Dim LBMonth as Variant
AC = Me.OpenArgs 'Which is a lookup value from the original form. In
this example AC=1
lbMonth = "Forms![Discipline Project Input Screen]!" & "lblMonth" &
Right(AC, 1)
PDate = lbMonth.caption
Call OpenF(JEProj, PDate)

When I run the code I receive "Runtime Error 424. Object required.

  #2  
Old February 27th, 2007, 02:15 PM
storrboy
Guest
 
Posts: n/a
Default Re: Form Lookup

On Feb 27, 8:15 am, njand...@gmail.com wrote:
Quote:
Hi,
I am trying to pass a form lookup that is built in code. I will give
an example below.
Truncated to only show the relevent information.
>
Dim PDate as String
Dim LBMonth as Variant
AC = Me.OpenArgs 'Which is a lookup value from the original form. In
this example AC=1
lbMonth = "Forms![Discipline Project Input Screen]!" & "lblMonth" &
Right(AC, 1)
PDate = lbMonth.caption
Call OpenF(JEProj, PDate)
>
When I run the code I receive "Runtime Error 424. Object required.

What line is causing the error?

  #3  
Old February 27th, 2007, 02:45 PM
njandtmp@gmail.com
Guest
 
Posts: n/a
Default Re: Form Lookup

On Feb 27, 8:02 am, "storrboy" <storr...@sympatico.cawrote:
Quote:
On Feb 27, 8:15 am, njand...@gmail.com wrote:
>
Quote:
Hi,
I am trying to pass a form lookup that is built in code. I will give
an example below.
Truncated to only show the relevent information.
>
Quote:
Dim PDate as String
Dim LBMonth as Variant
AC = Me.OpenArgs 'Which is a lookup value from the original form. In
this example AC=1
lbMonth = "Forms![Discipline Project Input Screen]!" & "lblMonth" &
Right(AC, 1)
PDate = lbMonth.caption
Call OpenF(JEProj, PDate)
>
Quote:
When I run the code I receive "Runtime Error 424. Object required.
>
What line is causing the error?
PDATE.

  #4  
Old February 27th, 2007, 03:25 PM
storrboy
Guest
 
Posts: n/a
Default Re: Form Lookup

Dim PDate as String
Quote:
Quote:
Quote:
Dim LBMonth as Variant
AC = Me.OpenArgs 'Which is a lookup value from the original form. In
this example AC=1
lbMonth = "Forms![Discipline Project Input Screen]!" & "lblMonth" &
Right(AC, 1)
PDate = lbMonth.caption
Call OpenF(JEProj, PDate)
>
Quote:
Quote:
When I run the code I receive "Runtime Error 424. Object required.
>
Quote:
What line is causing the error?
>
PDATE.

A few things I would make sure of...
1) Is AC a variant? If for any reason OpenArgs is not used or supplied
it will be Null and this code will fail on that. If a variant is not
used, it would be wise to trap form Nulls

2) Is the OpenArgs value alwasy going to be a one digit number? Is the
entrie OpenArgs value going to used in the control Assignment or just
the right-most character? If the whole argument is used then you don't
need to use the Right function.

3) LBMonth is shown as a variant. Are you attempting to assing the
control to this variable or its value. If the control, you should be
setting it as a control intead of a variant. When assigning objects to
a variable you need to use the Set statement. The fact that the
Caption property is not capitalized should indicate that the control
reference is not valid...

Dim LBMonth As Control
Set LBMonth = Forms("Discipline Project Input
Screen).Controls("lblMonth" & Right(AC, 1))
PDate = LBMonth.Caption

 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles