Can Anyone HELP?

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
 
G

Guest

Well, I know how you feel, having tried to learn all this
from the books. To do what is being talked about below
you could:

1. open a new form in design view, not linked to any
table or query--just a gray rectangle!

2. on the Tools sub-menu, click on the one that looks
like ab|. Put that on the form and you have a control
that you can enter or display stuf in, but is not tied to
any table at all--an "Unbound Control" in the parlance.
Right click to get the control's properties and name it
as you like, maybe DataInputField. Then you could refer
in your programming code to DataInputField to capture
what is in that field

3. Then add a button. Right click on the button to get
its properties, and select it's "On Click" event. A
submenu should pop up for you to start writing code.

4. The code could be something like below. To work with a
table programmatically you create and use a recordset to
the table you are interested in working with. Recordsets
are another long story....

-hope this helps

-----Original Message-----
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

Code Issues 0
Repost: Coding/Form Problems 0
Problems with Code? 2
Coding Issues 0
REPOST: Coding/Form Issues 0
Coding/Form Problems 0
REPOST: Problems with Code??? 0
REPOST: Problems with Code 0

Top