Continous Form Issue (Re-Post)

A

Anthony Viscomi

I have the following code that resides within a "click event" contained in a
Sub Form which is Continous:
Private Sub Action_Taken_Click()
If Me.Action_Taken.Value = True Then
Me.cboAction.Visible = True
MsgBox "Select an Action", vbInformation, "Action Required"
Me.cboAction.SetFocus
Else
Me.cboAction.Visible = False
End If
End Sub

The code runs fine; except for that when the Action_Taken is either True or
False all cboAction(s) on all records all Visible or not Visible. I assume
that there may be some sort of "Current Record" code that I should be using.
Can anyone direct me?

Thanks in advance! (Sorry for the re-post)
Anthony
 
A

Allan Murphy

Anthony

I had a similar problem but I was using an unbound text box. I overcame this
by adding a field to my table to record the value.

In your case you may need to add a field called say action_value and this
will store the value of the cbo.

There maybe a better way to overcome this problem.

Allan Murphy
Email: (e-mail address removed)
 
A

Anthony Viscomi

The cbo is already bound; thanks for your input.
Allan Murphy said:
Anthony

I had a similar problem but I was using an unbound text box. I overcame
this
by adding a field to my table to record the value.

In your case you may need to add a field called say action_value and this
will store the value of the cbo.

There maybe a better way to overcome this problem.

Allan Murphy
Email: (e-mail address removed)
 
M

Maxi

Anthony said:
I have the following code that resides within a "click event" contained in a
Sub Form which is Continous:
Private Sub Action_Taken_Click()
If Me.Action_Taken.Value = True Then
Me.cboAction.Visible = True
MsgBox "Select an Action", vbInformation, "Action Required"
Me.cboAction.SetFocus
Else
Me.cboAction.Visible = False
End If
End Sub

The code runs fine; except for that when the Action_Taken is either True or
False all cboAction(s) on all records all Visible or not Visible. I assume
that there may be some sort of "Current Record" code that I should be using.
Can anyone direct me?

Thanks in advance! (Sorry for the re-post)
Anthony

This is code that I use on a continuous form.
As the focus moves from record to record, you can copy, paste, whatever
to the active record.

Private sub Whatever
Dim n as integer
'CountEm is function that counts displayed records on a continuous form
For n = 1 To CountEm

'Cycle thru records on a continuous form
DoCmd.GoToRecord acDataForm, "frmRABud", acGoTo, n

'run code for active record

Next n
'on completion return to first record
DoCmd.GoToRecord acDataForm, "frmRABud", acFirst

End If


'count the number of records on the continuous form
Public Function CountEm()
On Error GoTo CountEm

Me.RecordsetClone.MoveLast
CountEm = Me.RecordsetClone.RecordCount

Exit_CountEm:
Exit Function

CountEm:
MsgBox Err.Description
Resume Exit_CountEm

End Function
 

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