PC Review


Reply
Thread Tools Rate Thread

Coding/Form Problems

 
 
James
Guest
Posts: n/a
 
      24th Jan 2004
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

 
Reply With Quote
 
 
 
 
Elwin
Guest
Posts: n/a
 
      24th Jan 2004
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
>
>.
>

 
Reply With Quote
 
James
Guest
Posts: n/a
 
      28th Jan 2004
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
>>
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access problems in my form's coding =?Utf-8?B?TC4gR3JlYW5l?= Microsoft Access Form Coding 3 28th Jun 2005 03:23 AM
Need help with form coding (Date Problems) Randy Microsoft Access Form Coding 1 11th Feb 2005 02:19 AM
REPOST: Coding/Form Problems James Microsoft Access VBA Modules 0 1st Feb 2004 12:34 PM
Repost: Coding/Form Problems James Microsoft Access VBA Modules 0 28th Jan 2004 02:03 PM
Coding/Form Problems James Microsoft Access VBA Modules 0 21st Jan 2004 02:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 AM.