473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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.

Feb 27 '07 #1
3 1969
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
3
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the...
2
by: Richard | last post by:
Help please. I am trying to autofill a form text field from a select-box lookup. I have no problem doing this if the select-box is part of the form but because there are 5 possible select boxes...
0
by: Lextendo | last post by:
Hi, This is what I want to achieve: I hav a lookup-form used by different parent forms to present a database table. So form X uses the lookup to search table tblA, form Y uses the lookup to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.