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
>
>.
>
|