473,383 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to copy data from a field on a form to same field in new form?

What I am trying to do is to , while in the current form, copy data from a field in the current record and paste it into the same field on the same form of a new record. This code below works in one database but it does not work in my current Db. I get the following error running the code below.

Run time error '438':
"Object doesn't support this property or method"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Template_Click()
  2.  
  3. Const cQuote = """"
  4.  
  5. Me!Project_Record_ID.DefaultValue = cQuote & Me!Project_Record_ID & cQuote
  6.  
  7. DoCmd.GoToRecord , , acNewRec
  8.  
  9. DoCmd.RunCommand acCmdSaveRecord       
  10.  
  11. End Sub
  12.  
Nov 7 '10 #1
3 1999
ADezii
8,834 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. Const cQuote = """"
  2. Dim ctl As Control
  3.  
  4. Set ctl = Me![Project_Record_ID]
  5.  
  6. ctl.DefaultValue = cQuote & Me![Project_Record_ID] & cQuote
  7.  
  8. DoCmd.RunCommand acCmdSaveRecord
  9.  
  10. DoCmd.GoToRecord , , acNewRec
Nov 8 '10 #2
Thanks again ADezii!

I changed to your suggested code and I now get the following error:
error 13 - Type mismatch

...on line 'Set ctl = Me![Project_Record_ID]'

Any idea why?
Nov 8 '10 #3
ADezii
8,834 Expert 8TB
No idea, since the Code is perfectly valid. Try Plan B:
Expand|Select|Wrap|Line Numbers
  1. Const cQuote = """"
  2.  
  3. Me![Project_Record_ID].DefaultValue = cQuote & Me![Project_Record_ID] & cQuote
  4.  
  5. DoCmd.RunCommand acCmdSaveRecord
  6.  
  7. DoCmd.GoToRecord , , acNewRec
Nov 8 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mary Litten | last post by:
Hi - (This is my very first post) I have gotten to this point of registering to post because I have been spinning my wheels so long, I believe I am all caught up in the weeds. (and mud) I have...
4
by: esuvs81 | last post by:
Hi, imagine I have a simple hierarchy with three classes - 'Base', 'Derived1', and Derived2. Base is an absrtact class and the two Derived classes are concrete. Imagine at some point in my code I...
0
by: berwiki | last post by:
I am trying to copy a table to another SQL 2000 Database, but I continually get errors. When I right-click, choose All-Tasks, Export-Data and go through the DTS settings, I get an 'Unspecified...
3
by: IvaPopova | last post by:
Hello, Consider this use strict; use Data::Dumper; my %hash1=(a=>, b=>, c=>,);
3
by: ipointer | last post by:
I am an experienced programmer that is fairly new to C++. I have written a small installation executable that is supposed to copy a set of files from within a directory just on the CD. The problem...
7
by: NeverLift | last post by:
This is probably answered elsewhere, but I've searched the Web and VBA for Excel manual, find no answers. I have a VBA-coded macro in an Excel workbook that is to open another existing workbook --...
1
by: =?Utf-8?B?Y3JhbmtlX2JveQ==?= | last post by:
Hi Folks, I'm not sure where this post belongs since I'm using managed vc.net, but the issue is around GDI BitBlt. Here is a summary of the problem: - I am trying to copy a bitmap of my main...
1
by: =?Utf-8?B?c3BhaW5jYw==?= | last post by:
I have always been able to create folders with pictures from my digital camera. Then by selecting all pictures and then selecting copy to cd, I could copy my pictures to a CDRW. Now I am...
2
by: ApexData | last post by:
Access2000, using a continuous form. I’m getting a message that say “you cannot add or change a record because a related record is required in table Employee”. This occurs in all my combobox...
10
by: jacc14 | last post by:
Hi I am sure there is an easy way to do this but I have exhausted all avenues. I have some label data in a table which I want to copy to an identical table. However the first label I may only...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.