Add new record in a form

rsbutterfly16

Registered User.
Local time
Yesterday, 21:46
Joined
Jun 5, 2006
Messages
77
hi guys, i was wondering if you can help me, i have a form in access the code is kind of big but i am only having a problem when adding a new record so here is that part .

the problem is that when someone enters an account code that needs to be added then it refreshes the form, and the fields where the account code was already entered is blank. (Account _Code). so i have to enter it again. and also it does not record the data entered in the ComboA, combob and comboC
please see if you can help

Private Sub cmdNew_Record_Click()


[Form_LOC Data Entry Form].Account_Code.SetFocus
'---------Account was not found, so it will be a new record.--------------------

strSQL = "SELECT PM_Contract_ID FROM dbo_Contracts "
Me.combo_contractquery.RowSource = strSQL 'new record set

'---------Add the query to the control source of Contract ---------
Set qdf = dbs.CreateQueryDef("qryLocateFEC", strSQL)

Me.cboStatus.Enabled = True
Me.combo_contractquery.Enabled = True
Me.ComboA.Enabled = True
Me.ComboB.Enabled = True
Me.ComboC.Enabled = True



DoCmd.GoToRecord , , acNewRec 'add new Account

End If


thank you in advance
 
instead of all the code above try this
Code:
Private Sub cmdNew_Record_Click()

Me.DataEntry = True
Me.RecordSource = "dbo_Contracts"

end sub


sam
 

Users who are viewing this thread

Back
Top Bottom