Description Lookup ( binding a form? )

G

Guest

In my database ( Which is used for inventory and work orders etc.. ) I have a
form that the employees use to check out parts ( form name "WOCheckOut" )
which puts the checked out items into table "Work Order Check Out". I have
the main Inventory table ( Table name "TblAcq" ) that has part numbers and
descriptions etc that is added to as inventory comes in. What I am trying to
do is when an Employee checks out a part ( by part number ) a description in
the form auto fills out using the description from the TblsAcq table. On
the form in "Part Number" on after update I have this code:

Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant

strSearch = Me!Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "[Part Number] = '" &
strSearch & "'")

Me!Part_Description.Value = varX

End Sub

And when run I get a 2465 Run time error " Can't find field "Part_Number"
Error

I saw where this can happen if the form isn't bound to the table?

Any help??

Thanks!!! Trying to learn this program as best and fast as I can!


Cat
 
D

Douglas J. Steele

That error should have nothing to do with whether or not the form is bound.

Assuing it's occuring on the line

strSearch = Me!Part_Number

it means that you don't have a control named Part_Number on your form.
 
G

Guest

There is a TextBox on the form called "Part Number" as well as a field in the
table in TblAcq called Part_Number and the output table "work order check out"

you are ccorrect it's happening on the "strSearch = Me!Part_Number" Line



Douglas J. Steele said:
That error should have nothing to do with whether or not the form is bound.

Assuing it's occuring on the line

strSearch = Me!Part_Number

it means that you don't have a control named Part_Number on your form.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The Catworks Cat said:
In my database ( Which is used for inventory and work orders etc.. ) I
have a
form that the employees use to check out parts ( form name "WOCheckOut" )
which puts the checked out items into table "Work Order Check Out". I have
the main Inventory table ( Table name "TblAcq" ) that has part numbers and
descriptions etc that is added to as inventory comes in. What I am trying
to
do is when an Employee checks out a part ( by part number ) a description
in
the form auto fills out using the description from the TblsAcq table.
On
the form in "Part Number" on after update I have this code:

Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant

strSearch = Me!Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "[Part Number] = '" &
strSearch & "'")

Me!Part_Description.Value = varX

End Sub

And when run I get a 2465 Run time error " Can't find field "Part_Number"
Error

I saw where this can happen if the form isn't bound to the table?

Any help??

Thanks!!! Trying to learn this program as best and fast as I can!


Cat
 
G

Guest

If I change the code to this.. ( taking the Me! out )
Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant, varY As Variant

varY = Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "Part Number = '" & varY & "'")

Part_Description.Value = varX




End Sub

it finds the part number from the form, but then I get aRun Time error 3075,
syntax error missing operator in query expression 'Part Number='7812300513"
( which is the part number i entered in the form )



Douglas J. Steele said:
That error should have nothing to do with whether or not the form is bound.

Assuing it's occuring on the line

strSearch = Me!Part_Number

it means that you don't have a control named Part_Number on your form.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The Catworks Cat said:
In my database ( Which is used for inventory and work orders etc.. ) I
have a
form that the employees use to check out parts ( form name "WOCheckOut" )
which puts the checked out items into table "Work Order Check Out". I have
the main Inventory table ( Table name "TblAcq" ) that has part numbers and
descriptions etc that is added to as inventory comes in. What I am trying
to
do is when an Employee checks out a part ( by part number ) a description
in
the form auto fills out using the description from the TblsAcq table.
On
the form in "Part Number" on after update I have this code:

Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant

strSearch = Me!Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "[Part Number] = '" &
strSearch & "'")

Me!Part_Description.Value = varX

End Sub

And when run I get a 2465 Run time error " Can't find field "Part_Number"
Error

I saw where this can happen if the form isn't bound to the table?

Any help??

Thanks!!! Trying to learn this program as best and fast as I can!


Cat
 
D

Douglas J. Steele

What is the text box named? Part Number (with a space) or Part_Number (with
an underscore)? (You're inconsistent in how you're referring to it in your
post)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The Catworks Cat said:
There is a TextBox on the form called "Part Number" as well as a field in
the
table in TblAcq called Part_Number and the output table "work order check
out"

you are ccorrect it's happening on the "strSearch = Me!Part_Number" Line



Douglas J. Steele said:
That error should have nothing to do with whether or not the form is
bound.

Assuing it's occuring on the line

strSearch = Me!Part_Number

it means that you don't have a control named Part_Number on your form.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The Catworks Cat said:
In my database ( Which is used for inventory and work orders etc.. ) I
have a
form that the employees use to check out parts ( form name
"WOCheckOut" )
which puts the checked out items into table "Work Order Check Out". I
have
the main Inventory table ( Table name "TblAcq" ) that has part numbers
and
descriptions etc that is added to as inventory comes in. What I am
trying
to
do is when an Employee checks out a part ( by part number ) a
description
in
the form auto fills out using the description from the TblsAcq table.
On
the form in "Part Number" on after update I have this code:

Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant

strSearch = Me!Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "[Part Number] = '" &
strSearch & "'")

Me!Part_Description.Value = varX

End Sub

And when run I get a 2465 Run time error " Can't find field
"Part_Number"
Error

I saw where this can happen if the form isn't bound to the table?

Any help??

Thanks!!! Trying to learn this program as best and fast as I can!


Cat
 
G

Guest

Thanks for the help and response! I do appriciate it.
I got it to work finally using this:


Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant, varY As Variant

varY = Part_Number

varX = DLookup("[Part Description]", "TblAcq", "[Part Number] = '" & varY &
"'")

Part_Description.Value = varX

Douglas J. Steele said:
What is the text box named? Part Number (with a space) or Part_Number (with
an underscore)? (You're inconsistent in how you're referring to it in your
post)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


The Catworks Cat said:
There is a TextBox on the form called "Part Number" as well as a field in
the
table in TblAcq called Part_Number and the output table "work order check
out"

you are ccorrect it's happening on the "strSearch = Me!Part_Number" Line



Douglas J. Steele said:
That error should have nothing to do with whether or not the form is
bound.

Assuing it's occuring on the line

strSearch = Me!Part_Number

it means that you don't have a control named Part_Number on your form.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message In my database ( Which is used for inventory and work orders etc.. ) I
have a
form that the employees use to check out parts ( form name
"WOCheckOut" )
which puts the checked out items into table "Work Order Check Out". I
have
the main Inventory table ( Table name "TblAcq" ) that has part numbers
and
descriptions etc that is added to as inventory comes in. What I am
trying
to
do is when an Employee checks out a part ( by part number ) a
description
in
the form auto fills out using the description from the TblsAcq table.
On
the form in "Part Number" on after update I have this code:

Private Sub Part_Number_AfterUpdate()

Dim strSearch As String, varX As Variant

strSearch = Me!Part_Number

varX = DLookup("[Part_Description]", "TblAcq", "[Part Number] = '" &
strSearch & "'")

Me!Part_Description.Value = varX

End Sub

And when run I get a 2465 Run time error " Can't find field
"Part_Number"
Error

I saw where this can happen if the form isn't bound to the table?

Any help??

Thanks!!! Trying to learn this program as best and fast as I can!


Cat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top