By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,454 Members | 2,629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,454 IT Pros & Developers. It's quick & easy.

Form Lookup

P: n/a
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.

Feb 27 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Feb 27, 8:15 am, njand...@gmail.com wrote:
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?

Feb 27 '07 #2

P: n/a
On Feb 27, 8:02 am, "storrboy" <storr...@sympatico.cawrote:
On Feb 27, 8:15 am, njand...@gmail.com wrote:
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?
PDATE.

Feb 27 '07 #3

P: n/a
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?

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

Feb 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.