Code Issues

J

James

Right ok I have been given the following code to stop all
the records being produced on the form when opened and I
would like to know what exactly the explinaton below means:

I'd approach your first issue with an 'Unbound' form and
controls. That means the form doesn't have
a 'RecordSource', and the controls don't have
a 'ControlSource'. Enter your information into the
unbound fields and click on a command button to write the
info to your table. Use something similar to the
following as the On_Click event sub procedure...

Private Sub CommandButtonName_Click()
Dim rst as DAO.Recordset
Set rst = CurrentDb.OpenRecordset(dbOpenDynaset)
With rst
.AddNew
!Field1 = Me!1stControlName
!Field2 = Me!2ndControlName
!Field3 = Me!3rdControlName
.Update
End With
rst.Close
Set rst = Nothing
Me!1stControlName = Null
Me!2ndControlName = Null
Me!3rdControlName = Null
MsgBox "Record has been written."
End Sub

Right I will tell you about the set-up...

I am trying to create a Search form and I have three
subforms. I have a combo box whoch dependant on its value
opens the relevant subform. Now then one of the subforms
has the problem described above where as the other two do
not. So I have the subforms set-up so that everything is
disabled and when you put a tick in the chkbox it enables
the relevant field. so that then I search on that
particular field and then I click the search button which
has the following code:

FilterMe = "[id] > 0"
If chkcisco1 Then FilterMe = FilterMe & " AND [Forname]
= " & cbocisco1
DoCmd.ApplyFilter , FilterMe

Thats an example of one of the combo boxes on one of the
subforms.

Any help would be greatly appreciated.

James
 

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

Similar Threads

Can Anyone HELP? 1
Repost: Coding/Form Problems 0
Coding Issues 0
Problems with Code? 2
REPOST: Coding/Form Issues 0
Coding/Form Problems 0
REPOST: Problems with Code??? 0
REPOST: Problems with Code 0

Top