Repost: Coding/Form Problems

J

James

Hello again...

I have just come into work sunce you responded to my
query...

Ok the first one implies some controls to be written in
code??? What sort of controls are we looking at here??

Second that code you gave me from before was good but the
thing is its for a combo box containing values... Should
this be taken out and a text box in its place?

Thanks

James
-----Original Message-----
Marijuana is bad for you. You should never post to these
forums while you're high.

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

I'm sure your second issue has to do with the absense of
delimiters around your criteria values. You provided an
example of...

" AND [Forname]=" & cbocisco1

Which is fine if 'Forname' stores numeric values, however
if it's a text field it should read...

" AND [Forname]='" & cbocisco1 & "'"

if it's a date field it should read...

" AND [Forname]=#" & cbocisco1 & "#"

Good luck!
-----Original Message-----
Hello I have a form and I have a combo box and when you
select a value on that combo box it pops up a relevant
subform. So for arguments sake:

Combo1 = CISCO
the subform that is displayed contains CISCO Details.

This works fine.

I have a few problems:

1) The problem is when I ask it to display the forms they
come up with everything showing and I dont want that to
happen. well it is on one form the CISCO one and I have
the "Data Entry" property set to yes...The other two forms
are fine and show nothing. Any suggestions?

2) I am creating a search form and I have a filter of [ID]
0. The following code on the search button. I am only
testing this on one form fist to get it working so that
then I can encorporate everything into my other two forms.

Here is the code I am using for the search button:

---------------------------------------------------------
-
-
FilterMe = "[id] > 0"

If chkcisco1 Then FilterMe = FilterMe & " AND [Forname]
= " & cbocisco1

If chkcisco2 Then FilterMe = FilterMe & " AND [Location]
= " & cbocisco2

If chkcisco3 Then FilterMe = FilterMe & " AND [Surname]
= " & cbocisco3

If chkcisco4 Then FilterMe = FilterMe & " AND [Department]
= " & cbocisco4

If chkcisco5 Then FilterMe = FilterMe & " AND [Support
From] = " & cbocisco5

If chkcisco6 Then FilterMe = FilterMe & " AND [CISCO
Username] = " & cbocisco6

If chkcisco7 Then FilterMe = FilterMe & " AND [Type of
Dialin] = " & cbocisco7

DoCmd.ApplyFilter , FilterMe
---------------------------------------------------------
-
-

What could possibly be wrong? What have I missed?

Many Thanks

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

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

Top