New blank Record on Form (1 Viewer)

sweetcaro

New member
Local time
Today, 09:55
Joined
May 25, 2001
Messages
9
I am new at Access and still trying to figure it out.
I created a simple form where users can enter some data and then print it to a report (it's a lease).
Everything seems to be working ok except that whenever I click on FORM to open it, it shows the last record and if you make changes to it it doesn't update.
This is what I need:
1) I want to see a blank new record when I open form.
2) I want to be able to scroll back to old records and edit them. Even though I'm able to do this, change information and so on... when I click on my preview command at the bottom of the form it doesn't show the changes I just made...
3) how do I make it so once the user is done entering all the info he can print/save that record with one button?
 

charityg

Registered User.
Local time
Today, 09:55
Joined
Apr 17, 2001
Messages
634
1) To automatically open the form to a new record, set the forms DataEntry Property (on the Data tab) to Yes.

2) & 3) involve the same problem. If you are new to Access, the wizards are really handy for learning how to use VBA (the code that makes all of your forms do cool stuff). Using the wizard, create a command button on the form to "Save Record". Then go to the onclick event of that command button and cut the line of code beginning with "DoCmd" and paste that line of code in the Preview button's onclick event above the "DoCmd.OpenReport" line. If you also have a Print button, paste the code in the onclick event of that button too.

Delete the rest of the Save button's code, and then delete the save button from your form.

What you did was force access to save the record before printing.

HTH
Charity

[This message has been edited by charityg (edited 05-25-2001).]
 

sweetcaro

New member
Local time
Today, 09:55
Joined
May 25, 2001
Messages
9
I must be doing something wrong.
First when you mean CUT the line you mean actually cut it out or COPY it then paste it.
What am I doing when I'm pasting that line in those places you told me?

Second. Everytime I open the form it shows record 1 of 1 even though the table has 3 records. When I enter new information in that record and click on my preview report button it always shows the same record in the table, not the new record i just created.

I have the Data Entry set up to YES in the form properties. I also created a macro on open form that goes to a new record but none of this seems to work.
 

sweetcaro

New member
Local time
Today, 09:55
Joined
May 25, 2001
Messages
9
This is what my save record and print record looks like
Private Sub saverecord_Click()
On Error GoTo Err_saverecord_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_saverecord_Click:
Exit Sub

Err_saverecord_Click:
MsgBox Err.Description
Resume Exit_saverecord_Click

End Sub
Private Sub printreport_Click()
On Error GoTo Err_printreport_Click

Dim stDocName As String

stDocName = "Summary"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport stDocName, acNormal

Exit_printreport_Click:
Exit Sub

Err_printreport_Click:
MsgBox Err.Description
Resume Exit_printreport_Click

End Sub
 

sweetcaro

New member
Local time
Today, 09:55
Joined
May 25, 2001
Messages
9
This is what my Form load looks like:
Private Sub Form_Load()

End Sub

SHouldn't there be some command there that tells it to go to a new record?
 

charityg

Registered User.
Local time
Today, 09:55
Joined
Apr 17, 2001
Messages
634
You're on the right track. I think you missed my first suggestion of changing the form's DataEntry property.

Delete all code associated with the saverecord button, you don't need it anymore.

Go to Access help and look up "Print Current Record"

If you still aren't getting what you want, email me.
 

Users who are viewing this thread

Top Bottom