Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a record problem 2

Status
Not open for further replies.

Chummly66

MIS
Feb 19, 2005
106
US
Hey there everyone,

I've run into this and for the life of me can't figure it out.

I have a record to which I want to add a copy button to. I use the standard Button tool and select Duplicate record.

But whenever I try this, I get an error stating "Object does not support this property or method" Runtime error 438. The field its choking on, is a combo box, where I have it reading from a table/query showing me a listing of employee ID's. Also attached to the After_Update of this combo box, is a statement to automatically fill in the employee name, also read off the query, in a bound text box.

So, basically, the copy looks like its able to place the employee ID into the combo box, but the code behind that to automatically fill in the employee name is causing the error.

The code is: Me!cboStoreID = Me![txtStoreLocation].Column(1)


Any thoughts? I use the same copy command on another form with the same combo boxes and the same code as above, without any issues.

Thanks in advance guys!
 
It looks like you have your backwards. I assume
txtStoreLocation
is a text box, but you are using the column property. Thus the error since a text box does not have a column property.
Maybe
Me!cboStoreID.column(1) = Me![txtStoreLocation]
 
MajP,

Not sure what you mean by backwards.

cboStoreID is a combo box which is set to a query. Once I select the peoper ID, the code automatically looks at the query for cboStoreID, and automatically fills in txtStoreLocation with whatever is in column 1 of cboStoreID

In other words, the query for cboStoreID shows:

0001 Location A
0002 Location B
0003 Location C

I select 0001 in cboStoreID, and txtStoreLocation automatically fills with "Location A".

Also, this code has been working since I've been using it. My question is why when I try and duplicate a record, it fails whenever I get to a text box which is automatically filled by the code I originally posted.

 
So, the code should be:
Me!txtStoreLocation = Me!cboStoreID.Column(1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I must not communicate clearly.

And no this never worked
Me!cboStoreID = Me![txtStoreLocation].Column(1)
 
Ok... after getting hit along the side of my head with a pile of bricks, the light came on.

Thanks you guys for your help!

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top