Opening a form and unable to edit it?

T

Tony Williams

I have a search form (in Continuos format) with limited fields that when the
user selects a record from it and presses a command button a form is opened
that shows the whole record. However when this form opens it isn't editable.
I've change the Data property to inconsistent updates but I still can't edit
the form. Here is my code to open the form:
Private Sub cmdopenrecord_Click()
On Error GoTo Err_cmdopenrecord_Click
Dim strVRM As String
'set strVRM equal to the selected value before closing the form,
otherwise it will give us an error
strVRM = Me.VRM.Value

Forms!frmMain!SubForm1.SourceObject = "frmVehicle"
Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [qryvehicle]
WHERE [txtVRM] = '" & strVRM & "'"

Exit_cmdopenrecord_Click:
Exit Sub

Err_cmdopenrecord_Click:
MsgBox Err.Description
Resume Exit_cmdopenrecord_Click

End Sub

Can someone help with making this code open an editable version of the form
frm.vehicle which is a subform of frm.main.

many thanks
Tony
 
T

Tony Williams

Sorry guys, cracked it! I change the record source to a table rather than the
query and it worked.
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top