If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
From help
Can some advice me on how to create in a form
a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#2
|
|||
|
|||
From help
It is not necessary to move to a different record for it to update. If you
close the form, it will update; however, if you want a button on the form to update it manually, all you need in the button's click event is: If Me.Dirty Then Me.Dirty = False End If Are you saying you want to create an identical record in the same table? Why would you do that? If you have a primary key, you can't do that. If you don't have a primary key, your database design is lacking. If you want to duplicate a record in another table, say for history purposes, etc., then write the SQL to append the data in the form to the other table. "Rodney James" wrote: Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#3
|
|||
|
|||
From help
Can you step me through how to create the button to do that?
"Klatuu" wrote in message ... It is not necessary to move to a different record for it to update. If you close the form, it will update; however, if you want a button on the form to update it manually, all you need in the button's click event is: If Me.Dirty Then Me.Dirty = False End If Are you saying you want to create an identical record in the same table? Why would you do that? If you have a primary key, you can't do that. If you don't have a primary key, your database design is lacking. If you want to duplicate a record in another table, say for history purposes, etc., then write the SQL to append the data in the form to the other table. "Rodney James" wrote: Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#4
|
|||
|
|||
From help
In design view of the form, put a command whereever you want it to be.
Open the Properties dialog for the button. Select the Events tab. Click the command button with the 3 dots to the right of the On Click event. Select Code Builder. Enter the code in the VBA editor when it opens. If Me.Dirty Then Me.Dirty = False End If "Rodney James" wrote: Can you step me through how to create the button to do that? "Klatuu" wrote in message ... It is not necessary to move to a different record for it to update. If you close the form, it will update; however, if you want a button on the form to update it manually, all you need in the button's click event is: If Me.Dirty Then Me.Dirty = False End If Are you saying you want to create an identical record in the same table? Why would you do that? If you have a primary key, you can't do that. If you don't have a primary key, your database design is lacking. If you want to duplicate a record in another table, say for history purposes, etc., then write the SQL to append the data in the form to the other table. "Rodney James" wrote: Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#5
|
|||
|
|||
From help
I got the update button thanks
Now The Copy button I have an autonumber as my primary key so If it makes a copy wouldnt the autonumber give it a new number? "Rodney James" wrote in message ... Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#6
|
|||
|
|||
From help
Create an append query that adds a record to the table using the values of
your controls. For example, lets say you have a field in the table named [Company_Name] and the control on the form is txt.CompName. Create a new query in design view. Select your table as the Append To. In the Field row, enter the name of the control Forms!MyFormName!txtCompName In the Append To row enter the name of the field [Company_Name] Do this for all the fields Except the autonumber field (it will take care of itself) Then the code behind the button is simple: CurrentDb.Execute("QueryNameHere"), dbFailOnError "Rodney James" wrote: I got the update button thanks Now The Copy button I have an autonumber as my primary key so If it makes a copy wouldnt the autonumber give it a new number? "Rodney James" wrote in message ... Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#7
|
|||
|
|||
From help
Ok I got that thanks I have another how to questions if you are up for it I
really appreciate all your help In my form I want to be able to filter down what records users are working with in the list. I have a few drop down tables that the filter would be applied from: Project Status, Project Type, Product Type So for instance. I have 100 Records I choose a field in Project status to a particular status "Project in Progress" now I have 50 records in the form that match that criteria I then choose a field in Project Type to a particular type "Lighting" now I have 25 records in the form that match this and the preceding criteria. I lastly choose a field Product Type and pear down the list to 5 records based on the three fields I want the filter to work based on any combination of the three fields "Klatuu" wrote in message ... In design view of the form, put a command whereever you want it to be. Open the Properties dialog for the button. Select the Events tab. Click the command button with the 3 dots to the right of the On Click event. Select Code Builder. Enter the code in the VBA editor when it opens. If Me.Dirty Then Me.Dirty = False End If "Rodney James" wrote: Can you step me through how to create the button to do that? "Klatuu" wrote in message ... It is not necessary to move to a different record for it to update. If you close the form, it will update; however, if you want a button on the form to update it manually, all you need in the button's click event is: If Me.Dirty Then Me.Dirty = False End If Are you saying you want to create an identical record in the same table? Why would you do that? If you have a primary key, you can't do that. If you don't have a primary key, your database design is lacking. If you want to duplicate a record in another table, say for history purposes, etc., then write the SQL to append the data in the form to the other table. "Rodney James" wrote: Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
#8
|
|||
|
|||
From help
I would suggest a command button that would apply the filter. It would be
something like this in the Click event: Dim strFilter As String If Not IsNull(Me.ProjectStatus) Then strFilter = "[ProjectStatus] = '" & Me.ProjectStatus & "'" End If If Not IsNull(Me.ProjectType) Then If Len strFilter 0 Then strFilter = strFilter & " AND " End If strFilter = strFilter & "[ProjectType] = '" & Me.ProjectType & "'" End If If Not IsNull(Me.ProductType) Then If Len strFilter 0 Then strFilter = strFilter & " AND " End If strFilter = strFilter & "[ProductType] = '" & Me.ProductType & "'" End If Me.Filter = strFilter Me.FilterOn = True "Rodney James" wrote: Ok I got that thanks I have another how to questions if you are up for it I really appreciate all your help In my form I want to be able to filter down what records users are working with in the list. I have a few drop down tables that the filter would be applied from: Project Status, Project Type, Product Type So for instance. I have 100 Records I choose a field in Project status to a particular status "Project in Progress" now I have 50 records in the form that match that criteria I then choose a field in Project Type to a particular type "Lighting" now I have 25 records in the form that match this and the preceding criteria. I lastly choose a field Product Type and pear down the list to 5 records based on the three fields I want the filter to work based on any combination of the three fields "Klatuu" wrote in message ... In design view of the form, put a command whereever you want it to be. Open the Properties dialog for the button. Select the Events tab. Click the command button with the 3 dots to the right of the On Click event. Select Code Builder. Enter the code in the VBA editor when it opens. If Me.Dirty Then Me.Dirty = False End If "Rodney James" wrote: Can you step me through how to create the button to do that? "Klatuu" wrote in message ... It is not necessary to move to a different record for it to update. If you close the form, it will update; however, if you want a button on the form to update it manually, all you need in the button's click event is: If Me.Dirty Then Me.Dirty = False End If Are you saying you want to create an identical record in the same table? Why would you do that? If you have a primary key, you can't do that. If you don't have a primary key, your database design is lacking. If you want to duplicate a record in another table, say for history purposes, etc., then write the SQL to append the data in the form to the other table. "Rodney James" wrote: Can some advice me on how to create in a form a button that saves/updates the current record that a user is working on with out having to go form one record to another A button that will create a duplicate record by clicking it. |
Thread Tools | |
Display Modes | |
|
|