Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help opening a form at a new record with default values

Status
Not open for further replies.

src2

Technical User
Mar 1, 2001
72
US
I'm working on a Bill reminder database in access 2000. I have an unbound form with a listbox displaying all my bills. When I select a bill in the listbox it displays the due date, amount, etc. on the current form. I have a command button to open another form to "pay the bill". When this form opens the amount, current date, etc is displayed for this bill. If all the information is correct I want to click a button to "save" the payment detail without having to tab through any fields. If any of the information is incorrect I want to be able to edit it and then save the payment detail. What is working is my form is opening and displaying the correct bill information but the billdetailid hasn't been given a new number (the id field is set to autonumber). When I click on my button in this form to save the bill detail the form closes but the detail isn't saved. Can anyone help me get this to work the way I want?

Thanks
 
Hi
I am not quite clear on your set up. Could you please list the relevant field names for the table(s) you wish to update? A little code might be useful,too.
 
I think the reason the data is not being saved is because all of the controls are set to default values for new records. In other words, when a new record is displayed the default values are already shown on the form. Consequently, the form is not yet "dirty". So, you either have to force the form to be dirty by programmatically changing a value on the form or save the record programmatically or have the user press a save button.
 
Thanks to all who replied. FancyPrairie I do believe you're correct. My intent is to hit a save button but I'm not sure how to force the record to be dirty. BillDetailID is the key field set to autonumber. What I'd like is when the save button is pressed BillDetaiID increments and then saves the record. Do you know how to do this?

Thanks
 
When I select a bill...

With the AfterUpdate event for the ListBox, after displaying the record, you can add code to set the values you want. By adding the date programatically, you will start the BeforeInsert event and initiate the creation of the new record.

For example, assuming the name of the field that captures the payment date is BillPayDate...
Me.BillPayDate = Date()

Populate the rest of the fields as required and set the focus on the "Save" button you created.

Richard
 
Thanks for all the help. I spent quite a bit of time trying to get the solution willr proposed but never could get it. After a lot of persistance I did it a different way. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top