Open to Blank Form

kparadise

Board Regular
Joined
Aug 13, 2015
Messages
186
Hello, I have a Form which is linked to two tables. The top section I have it liked to a Picklist table containing projects. The middle section I have the form population a 'Projects Detail' table if you will. My form contains a drop down list which has all the project titles, and once it is selected, it populates 4 fields (date, employee, LOB, Team); this is all working great. The code is: Private Sub cboACTSID_Change() Me.txtNameofProject.Value = Me.cboATCSID.Column(1) Me.txtLOB.Value = Me.cboATCSID.Column(2) Me.txtTesterAssigned.Value = Me.cboACTSID.Column(3) Me.txtFinalDate.Value = Me.cboACTSID.Column(4) End Sub Once i select from the drop down list, and the above fields populate, I can then begin to enter the remaining information. Then once I click the Save Command Button, New Record Command Button, or exit out of the form, I can see the information on the correct table (Project Details). The problem is, if I go back into the form - it will show the first record, and if the user happens to select a different project from the drop down menu, and closes the form, or clicks Save/New Record Command Button, the detail already showing will now be saved under the newly selected project number (that the user just selected). What is the best option to prevent this? Should I insert a main menu button to either EDIT or CREATE NEW record? Should I open the form to a BLANK form?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hello, I have a Form which is linked to two tables. The top section I have it liked to a Picklist table containing projects. The middle section I have the form population a 'Projects Detail' table if you will. My form contains a drop down list which has all the project titles, and once it is selected, it populates 4 fields (date, employee, LOB, Team); this is all working great. The code is: Private Sub cboACTSID_Change() Me.txtNameofProject.Value = Me.cboATCSID.Column(1) Me.txtLOB.Value = Me.cboATCSID.Column(2) Me.txtTesterAssigned.Value = Me.cboACTSID.Column(3) Me.txtFinalDate.Value = Me.cboACTSID.Column(4) End Sub Once i select from the drop down list, and the above fields populate, I can then begin to enter the remaining information. Then once I click the Save Command Button, New Record Command Button, or exit out of the form, I can see the information on the correct table (Project Details). The problem is, if I go back into the form - it will show the first record, and if the user happens to select a different project from the drop down menu, and closes the form, or clicks Save/New Record Command Button, the detail already showing will now be saved under the newly selected project number (that the user just selected). What is the best option to prevent this? Should I insert a main menu button to either EDIT or CREATE NEW record? Should I open the form to a BLANK form?
 
Upvote 0
I figured it out:

Form_Load()
On Error GoTo NewRecord_Err

On Error Resume Next
DoCmd.GoToRecord , "", acNewRec

NewRecord_Exit:
Exit Sub

NewRecord_Err:
Beep
MsgBox Error$
Resume NewRecord_Exit
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,248
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top