Form footer visible only when values match

S

Sunflower

I have a form called "frmWOEDIT"

in the form DETAIL I have a combo box "cboWOID"
in the form footer I have a text box "WOID"

How do I have the form footer only show/visible when the the combo box
and text box values match?

Here is the code I have on the combo box:

Private Sub cboWOID_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[WOID] = " & Str(Me![cboWOID])
Me.Bookmark = rs.Bookmark
End Sub



Here is my attempt to get the formfooter to be visible

Me.FormFooter.Visible Then
Me.FormFooter.Visible = True


Any and all help appreciated
 
M

Mr. B

In addition to what Bonnie has said, you may want to have the code set the
visible property of the sub form for eather a match or no match as:

if me.WOID = me.cboWOID then
me.formfooter.visible = true
else
me.formfooter.visible = false
End if

Doing it this way will take care of things if someone decides to change the
combo box after they had a match to something that no longer matches.
 
S

Sunflower

In addition to what Bonnie has said, you may want to have the code set the
visible property of the sub form for eather a match or no match as:

if me.WOID = me.cboWOID then
     me.formfooter.visible = true
else
     me.formfooter.visible = false
End if

Doing it this way will take care of things if someone decides to change the
combo box after they had a match to something that no longer matches.

-----
HTH
Mr. B
askdoctoraccess dot com



Sunflower said:
I have a form called "frmWOEDIT"
in the form DETAIL I have a combo box "cboWOID"
in the form footer I have a text box "WOID"
How do I have the form footer only show/visible when the the combo box
and text box values match?
Here is the code I have on the combo box:
Private Sub cboWOID_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[WOID] = " & Str(Me![cboWOID])
    Me.Bookmark = rs.Bookmark
End Sub
Here is my attempt to get the formfooter to be visible
Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
Any and all help appreciated- Hide quoted text -

- Show quoted text -

It doesnt quite work...

I placed the following code in the combo box's "On Exit":

-------------------------------------------------------------------
Private Sub cboWOID_Exit(Cancel As Integer)
If Me.WOID = Me.cboWOID Then
Me.FormFooter.Visible = True
Else
Me.FormFooter.Visible = False
End If
End Sub
--------------------------------------------------------------------
NOTE: I have tried the Formfooter visible and not visible

Problem:
When I select a value from my combo box and hit enter, the form is
visiable but it does not display the matching record.
When I type in the combo box a value that I know has no matching
record, the form is visible showing a random record.

Any and all help appreciated
 
S

Sunflower

I think we were answering the question of how to make the formfooter visible
or not and this has brought up a different issue.  What is on the form footer
that you want to see and what is the datasource?   How is it related to
what's in the combobox?

Bonniehttp://www.dataplus-svc.com




In addition to what Bonnie has said, you may want to have the code setthe
visible property of the sub form for eather a match or no match as:
[quoted text clipped - 40 lines]
- Show quoted text -
It doesnt quite work...
I placed the following code in the combo box's "On Exit":
-------------------------------------------------------------------
Private Sub cboWOID_Exit(Cancel As Integer)
If Me.WOID = Me.cboWOID Then
    Me.FormFooter.Visible = True
Else
    Me.FormFooter.Visible = False
End If
End Sub
Problem:
When I select a value from my combo box and hit enter, the form is
visiable but it does not display the matching record.
When I type in the combo box a value that I know has no matching
record, the form is visible showing a random record.
Any and all help appreciated

Sorry I did not respond to you sooner…I was pulled onto another
project…

Anyway…
I am not sure how to answer your question (I am still a newbie at
Access)

Here goes…
My form footer contains several text boxes and a subform
All are connected (or related) to WOID

My combo box in the detail area and my text box on the form footer are
the main objects that must match…

Here is the code I have on the combo box:
Private Sub cboWOID_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[WOID] = " & Str(Me![cboWOID])
Me.Bookmark = rs.Bookmark
End Sub

By Datasource , do you mean Recordsource
Here is my SQL
SELECT tblWORKORDER.*, tblWORKORDER.DateDue, tblWORKORDER.Status
FROM tblWORKORDER
WHERE (((tblWORKORDER.Status)<>"Completed" And (tblWORKORDER.Status)
<>"Cancelled"))
ORDER BY tblWORKORDER.DateDue;

My problem (for even doing this)…
To prevent users from selecting a number from the combo box, and
without confirming the WOID text box matches, they will edit the
values in the other text boxes on the form.
I was hoping to eliminate users from making edits to the wrong
records.

If you have a better way to achieve my goal, I am more then willing to
try it!

Thank you for your patience
 

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

Top