DLookup

  • Thread starter Thread starter DixieLee
  • Start date Start date
D

DixieLee

I have a Dlookup macro that fills in an Item Number when a product is chosen
on a purchase order form. It works fine as long as the Item Number is only
numbers. If there is a letter or other character in the Item Number then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?
 
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
Um... something is still not right. I thought it had something to do with
text fields... but when I copied your DLookup, I got "MS Office cant find
the field PO Items"

Gina Whipp said:
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is
chosen
on a purchase order form. It works fine as long as the Item Number is only
numbers. If there is a letter or other character in the Item Number then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?


.
 
Oh, bu the way, PO Items is the subform of a main form called Open POs

Gina Whipp said:
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is
chosen
on a purchase order form. It works fine as long as the Item Number is only
numbers. If there is a letter or other character in the Item Number then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?


.
 
DixieLee,

Looking at the line below... What is the form name and what it the field
name? AND is the field on a subform?

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open POs]![PO
Items]![PO Item] & "'")

....perhaps it should be...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open POs]![PO
Item] & "'")

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
Um... something is still not right. I thought it had something to do with
text fields... but when I copied your DLookup, I got "MS Office cant find
the field PO Items"

Gina Whipp said:
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open
POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is
chosen
on a purchase order form. It works fine as long as the Item Number is
only
numbers. If there is a letter or other character in the Item Number
then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method
for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter
Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?


.
 
DixieLee,

Okay then ignore the reply I just sent...

I am assuming this DLookup is on the Main form???? If yes, try...

=DLookUp("[Item Number]","[Enter Items]","[Item]='" & [PO Iterms].[Form]![PO
Item] & "'")

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
Oh, bu the way, PO Items is the subform of a main form called Open POs

Gina Whipp said:
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open
POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is
chosen
on a purchase order form. It works fine as long as the Item Number is
only
numbers. If there is a letter or other character in the Item Number
then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method
for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter
Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?


.
 
Are you certain that the subform control on Open POs is named PO Items?
(Depending on how you add a form as a subform, the name of the subform
control may be different than the name of the form being used as a subform)

If you are, try using

Forms![Open POs]![PO Items].Form![PO Item]

If the subform control is named something different, use that instead of PO
Items.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


DixieLee said:
Oh, bu the way, PO Items is the subform of a main form called Open POs

Gina Whipp said:
DixieLee,

Sounds like your [PO Items] is a text field. Change your DLookup to...

=DLookup("[Item Number]", "[Enter Items]", "[Item]='" & Forms![Open
POs]![PO
Items]![PO Item] & "'")

....and see if that resolves your issue.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" -
Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is
chosen
on a purchase order form. It works fine as long as the Item Number is
only
numbers. If there is a letter or other character in the Item Number
then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method
for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter
Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?


.
 
DixieLee said:
I have a Dlookup macro that fills in an Item Number when a product is chosen
on a purchase order form. It works fine as long as the Item Number is only
numbers. If there is a letter or other character in the Item Number then I
get the message:

"You tried to run a Visual Basic procedure to set a property or method for
an object. However the component doesn't make the property or method
available for automation operations."

Here is the current macro:

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter Items]","[Item]=Forms![Open
POs]![PO Items]![PO Item]")

Can anyone help?

Item: [Forms]![Open POs]![PO Items]![PO Item Number]
Expression: =DLookUp("[Item Number]","[Enter Items]","[Item]='" & Forms![Open
POs]![PO Items]![PO Item] & "'"")

Does this work?

Tom Lake
 
Back
Top