Discussion Locked

Clear Details on Form /Cycle one record

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Ok this is a two part question and they aren't related.

1. I have a form that in the header there is an SSN and a name. I always want that to be there. In the details portion of the form I am adding information like dates, checkout places etc. So what I want to do is when I have all of the fields in the details portion filled out and want to overlay it, I would like it to automatically delete all of the old information. So I have a checkout date, return date, remarks etc. Now someone else wants to check it out so I want to quickly delete all of that information so the user can input new checkout dates and stuff.

2. I have a database that has many users. The users leave their call input screen up all day long. So the calls that they have added stay in the cycle of records on the form. Can I make it so that when they add the call it goes away to the table and does not stay visible on the form. So they can't arrow back and forth between records?

5 replies

by bob sellman

1. Put a button on the form for the user to click for a new checkout. When the button is clicked, blank out all of the details (and possibly put the current date in the checkout date), so you are removing previously entered data rather than creating a new record. You might want to add code that does not permit a new checkout unless the return date has already been entered in the displayed data.

2. Set the form so that only one record is displayed (rather than continuous display). If onecontrol will always be filled in last you could also put some code behind that control so that the record would be saved and a new record started. You might also consider setting the form properties so that editing and deleting records are set to false (add new records would be set to true).

by bob sellman

For #1:
Here's a rough idea of part of the code to put behind the on click property of the "Checkout" button. I'm going to use control names to describe the data they will carry (the field).

' check that return date is entered for current dataif isnull(me.returndate) then
msgbox("This book has not yet been returned!")
exit sub
end if
' set all controls except book title on current record to blank
except set checkout date to today's date (assuming it is a required column)
' booktitle will be the same book
me.checkoutdate = Date()
me.returndate = null
me.customer = null
' place cursor on the control that the user will most likely enter data into next
me.customer.setfocus

Note that if you want to recover if the customer decides to cancel the new checkout, you could save the current value in each control (except booktitle) into variables defined for the form (not just a module in the form) and put a button on the form "cancel new checkout". When that is clicked, set each control back to the value of the appropriate variable.

For #2:
If you absolutely don't want people to even see their previous entries, then set up a "data entry" table just like the one used for data entry. When the user saves the current record (by clicking a button), append the data entry table (which will only contain one record) to the "real" data table, delete the record from the data entry table, and go to a new record for the data entry table.

If you still want to let users see their previous entries but now allow any editing, set up another form with editing, deleting, and add new records all set to false.

Sorry, but I'm not sure if this answers your second requirement, since I find your problem description (and reason for try to do what you seem to want to do) confusing.

by bambamz

As usual you were a great help to me. The clear fields thing works wonderfully. I know that I am not very good at explaining what it is I want but somehow you always give me the answers that I need. Thanks again ! ! I'm back in business.

by bambamz

1. That is exactly what I want to do but I can't figure out how to write the code so that it will do that.

2. Sort of on the wrong track. They can only see one record and that is all good but they can still scroll back and see all of the records that they did that day until they go back to the main menu. I sort of want it to do that without going back to the main menu

This discussion is closed to new replies.