Is there a way to keep the data that is in a selected few textboxes after pushing New record Button? Currently all the textboxes are cleared. I would like a few of them to keep the data from the previous record.
To do this you need to generate variables for the fields you wish to keep and then add them back after you make the new record, the code would be similar to this;
Dim field1 as string
Dim field2 as string ... for as many as you need!
field1 = Me.txtBox1
field2 = Me.txtBox2 ... storing the fields
Docmd.GoToRecord,, acNewRec
Me.txtBox1 = field1
Me.txtBox2 = field2 ... restoring the values
Me.txtBox3.SetFocus
Right. And you'll have to get rid of Access's built in navigation buttons or set AllowAdditions to false and create a command button that users will have to use to add records.
Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
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.