views:

58

answers:

3
 Private Sub cmd_New_Click()
    Dim Response%
    If Me.Dirty Then
        Response = MsgBox("Save changes to the job record?", vbYesNoCancel, scAppTitle)
        Select Case Response
        Case vbYes
            SendKeys "+{Enter}"
        Case vbNo
            Me.Undo
        Case vbCancel
            Exit Sub
        End Select
    End If

    cbo_SourceID.Requery


    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec


    DoCmd.GoToControl CtlName(Me, 0)

End Sub

Recordset from comments below

SELECT tbl_Jobs.*,
 tbl_JobLocations.*,
 tbl_Invoices.*,
 tbl_Clients.client_ClientNumber,
 tbl_Clients.client_PrimaryContactID,
 tbl_Clients.client_Name,
 tbl_Clients.client_Address,
 tbl_Clients.client_Phone,
 [jobl_KeymapPage] & [jobl_KeymapGrid] AS qcalc_KMC,
 [client_City] & " " & [client_State] & " " &  [client_Zip] AS qcalc_ClientCSZ,
 [appr_FirstName] & " " & [appr_LastName] AS qcalc_ApprName,
 tbl_Appraisers.appr_Initials,
 tbl_Borrowers.bor_BorrowerName,
 tbl_Borrowers.bor_Address,
 tbl_Borrowers.bor_City,
 tbl_Borrowers.bor_State,
 tbl_Borrowers.bor_Zip,
 tbl_Borrowers.bor_Phone,
 tbl_Borrowers.bor_Fax,
 tbl_Borrowers.bor_Email,
 tbl_Borrowers.bor_Remarks,
 tbl_SaleSources.ssor_SourceDescription,
 tbl_Invoices.inv_RetainerInvoiceDate AS RetainerDate 
 FROM (tbl_Clients 
 INNER JOIN (tbl_Appraisers 
 RIGHT JOIN (((tbl_SaleSources 
 RIGHT JOIN tbl_Jobs 
      ON tbl_SaleSources.ssor_SourceID = tbl_Jobs.job_SaleSourceID) 
 LEFT JOIN tbl_Invoices 
      ON tbl_Jobs.job_JobNumber =tbl_Invoices.inv_JobNumber) 
 LEFT JOIN tbl_Borrowers 
      ON tbl_Jobs.job_JobNumber = tbl_Borrowers.bor_JobNumber) 
      ON tbl_Appraisers.appr_AppraiserID = tbl_Jobs.job_AppraiserID) 
      ON tbl_Clients.client_ClientID = tbl_Jobs.job_ClientID) 
 LEFT JOIN tbl_JobLocations 
      ON tbl_Jobs.job_JobNumber = tbl_JobLocations.jobl_JobNumber 
 ORDER BY tbl_Jobs.job_JobNumber; 
+1  A: 

Does your form and recordset allow additions? You can check this by looking at the navigation bar at the bottom of the form to see if the star (>*) is greyed out.

To open the property sheet, change the form to design view and select View->Properties from the menu.

Look at Allow Additions, if this is No, then that is probably the answer. Change it to Yes and check again if you can update the form, if this has not fixed the problem then ...

Look at the data tab, you will see Record Source - this is the data that the form is based on. If it is the name of a query, open the query and see if you can add a row to it. If it is an sql string (SELECT Stuff FROM table), cut and paste it as a comment.

Remou
Yes.It's been greyed out.
A.Vijay
That is why you have the error. You must check that the form allows additions (the data tab of form properties) and that your recordset is updateable. You can post the SQL for the recordset if you need help with it.
Remou
On behalf of @avijay - i'm very new to VBA so please tell me how to proceed for your suggestion.
shahkalpesh
Which version of Access are you using? Do you know how to open a form in design view? Do you know how to open the property sheet for the form?
Remou
I have added some notes for you.
Remou
A: 

Dear Remou i'm very new to VBA so please tell me how to proceed for your suggestion.

avijay
Please delete this. There is a difference between Answer and a comment. I have added your reply as comment under @Remou's answer. Use comments for discussion, answer for solution (as well as potential ones).
shahkalpesh
A: 

1]I'm using Access 2003 version. 2]yes i know how to open the Form in Design View. 3]No i don't have idea about the process to open the property sheet for the form

avijay
Please use comments. I up-voted in case comments are not yet available to you.
Remou
Dear Remou this is the query i'm using in the recordset stuff..i had send it as three splits due to character Limitation. Please help.
avijay
avijay
tbl_Borrowers.bor_Address, tbl_Borrowers.bor_City, tbl_Borrowers.bor_State, tbl_Borrowers.bor_Zip, tbl_Borrowers.bor_Phone, tbl_Borrowers.bor_Fax, tbl_Borrowers.bor_Email, tbl_Borrowers.bor_Remarks, tbl_SaleSources.ssor_SourceDescription, tbl_Invoices.inv_RetainerInvoiceDate AS RetainerDateFROM (tbl_Clients INNER JOIN (tbl_Appraisers RIGHT JOIN (((tbl_SaleSources RIGHT JOIN tbl_Jobs ON tbl_SaleSources.ssor_SourceID = tbl_Jobs.job_SaleSourceID) LEFT JOIN tbl_Invoices ON tbl_Jobs.job_JobNumber =
avijay
tbl_Invoices.inv_JobNumber) LEFT JOIN tbl_Borrowers ON tbl_Jobs.job_JobNumber = tbl_Borrowers.bor_JobNumber) ON tbl_Appraisers.appr_AppraiserID = tbl_Jobs.job_AppraiserID) ON tbl_Clients.client_ClientID = tbl_Jobs.job_ClientID) LEFT JOIN tbl_JobLocations ON tbl_Jobs.job_JobNumber = tbl_JobLocations.jobl_JobNumberORDER BY tbl_Jobs.job_JobNumber;
avijay
combining all the three parts is the query which i'm using
avijay
Please, I beg you, use Stackoverflow as it is intended! I have added this to your question.
Remou