I need to duplicate a record. Thats easy with the duplicate button, but I want the date field to be todays date and 2 other field to be blank. I am not a programmer and would like some help.
Thanks Aubrey
If that's your table:
[pre]
ID (AutoNumber) DateField Field1 Field2 Field3
1 1/1/2020 ABCD XYZ 765
2 2/2/2022 JHgy Hgb 123
3 3/3/2023 jhgg hgT 987
[/pre]
And you want to Copy record with ID = 2, I would try:
[tt]
INSERT INTO MyTable (DateField, Field1, Field2, Field3)
SELECT Date(), NULL, NULL, Field3 FROM MyTable Where ID = 2
[/tt]
Assuming Field1 and Field2 will accept NULLs, what you consider to be blank
(Not tested)
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
Are you entering records into a form and want the new record to default to some values from the previous record? If so, this is typically accomplished by setting the default value of controls to the current values.
Again, are you entering records into a form? That’s the appropriate way to create user interfaces. You could use a data sheet form which allows you to set default values.
30 fields is a lot especially if 27 might have duplicate values.
I am a pilot that flys test equipment for defense contractors. What happens is we complete a form with 30 fields on it . The form/field or the same for each mission with the exception of the date, a reference code, and hours. Now , I hit duplicate for each mission and change the date, reference code, and hours. I would like to hit duplicate and set the date field date(), and blank the reference code and hours. I add those after we land.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.