Copy field in form

If You have time I wolud ask you for a favour, can You put that command in db that I posted and attach so I can download
 
Ah I see what you mean. I didn't actually test the code I gave you before but the logic was right. So I've just tried the below on your database and this works for me:
Code:
    With DoCmd
        .RunCommand acCmdSelectRecord
        .RunCommand acCmdCopy
        .GoToRecord , , acNewRec
        Me.AllowEdits = True
        .SetWarnings False
        .RunCommand acCmdPaste
        .SetWarnings True
        Me.AllowEdits = False
    End With
 
Ah I see what you mean. I didn't actually test the code I gave you before but the logic was right. So I've just tried the below on your database and this works for me:
Code:
    With DoCmd
        .RunCommand acCmdSelectRecord
        .RunCommand acCmdCopy
        .GoToRecord , , acNewRec
        Me.AllowEdits = True
        .SetWarnings False
        .RunCommand acCmdPaste
        .SetWarnings True
        Me.AllowEdits = False
    End With

It's works Thank You very much
 
That simply means you want to copy some fields. It's the same thing isn't it?
 
Ok, how many fields do you not want to copy? And will this be constant?
 
Ok, two more questions:

1. Remind me how many fields you have?
2. Everytime you copy and paste, you definitely don't want those 80 fields copied?
 
I made mistake, I want to copy 80 fields

I have about 100 fields.
I dont want that fields to be copy but I want to be able to enter data in that fields
 
You can do it two ways after copying and pasting:

1. Delete the value of each control by setting it to Null
Code:
Me.NameOfTextbox1.Value = Null
Me.NameOfTextbox2.Value = Null
.
.
.
.
Me.NameOfTextbox20.Value = Null

Or

2. Put a text in the Tag property of each control, let's say "_Delete_", loop through each control and if you find the word "_Delete_" in the Tag property, set it to Null.
 
You can do it two ways after copying and pasting:

1. Delete the value of each control by setting it to Null
Code:
Me.NameOfTextbox1.Value = Null
Me.NameOfTextbox2.Value = Null
.
.
.
.
Me.NameOfTextbox20.Value = Null
Or

2. Put a text in the Tag property of each control, let's say "_Delete_", loop through each control and if you find the word "_Delete_" in the Tag property, set it to Null.

I like first idea Where to put that it is done automaticle after copy?
 
No! You put that after "Me.AllowEdits = False".
Remember you have to fill in the code for every single field.
 
No! You put that after "Me.AllowEdits = False".
Remember you have to fill in the code for every single field.

You mean something like this?

Private Sub Kopiranje_podataka_Click()
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.GoToRecord , , acNewRec
Me.AllowEdits = True
.SetWarnings False
.RunCommand acCmdPaste
.SetWarnings True
Me.AllowEdits = False
Me.Datum_ugovora.Value = Null
Me.Od_kada_je_kod_nas.Value = Null

End With
End Sub
 
To prevent user to forget to enter data I put in table option that field is required. Now when I copy and leave that option I get message that field required and I must enter value
 

Users who are viewing this thread

Back
Top Bottom