Multiline Form - Repost

M

Me

I still need help on the MultiLine form -
I have been able to place button on top of check box and
select the record. Now, how do I mark the record as
selected.

Any help would be highly appreciated.

Please refer original posting dated 8/26/2004 for
details...

Thank you,
-Me
 
G

Guest

Albert,

Greate web site!

That is how I want it to work. In my case it isn't working
'cause I don't have ContactId instead I have the
File_name I tried changing the function, but it didn't
help. Except that it doesn't show the checkbox/button as
checked in my case. But in your example it works great.

My check box is bound as = =IsChecked([file_name])

The function I changed to -

Option Compare Database
Option Explicit
Public FileName1 As String

Dim colCheckBox As New Collection

Public Function IsChecked(vID As String) As Boolean

Dim lngID As String

IsChecked = False

On Error GoTo exit1

lngID = colCheckBox(vID)
MsgBox "lngID " + FILE_NAME
If lngID <> Null Then
IsChecked = True
End If

exit1:

End Function

and button_click is as follows -

If IsChecked(Me.FILE_NAME) = False Then
colCheckBox.Add Me.FILE_NAME
Else
colCheckBox.Remove Me.FILE_NAME
End If
Me.Check_box.Requery

Any suggestions on why its not working?

Thank you,
-Me
 
A

Albert D. Kallal

Just add a autonumber field of "id" to that table. You can then use my code
as is (use

=IsChecked([id])

In fact, most tables by default have a autonubmer field called "id" anyway.
So, just add the ID column to your table in design view.

It is only a few mouse clicks..and then use my sample code as is...that
should do the trick....

note hat you do NOT have the "id" field displayed, or shown on the form...as
long as it is in the reocrdset for the form. so, if that form is based on a
query, and not directly on the table...then don't forget to add the "id"
field to the forms query...else "id" field will not be available.
 
M

Me

Albert,

I changed the function to the following and it worked -

Dim colCheckBox As New Collection

Public Function IsChecked(vID As String) As Boolean

Dim lngID As String

IsChecked = False

On Error GoTo exit1

lngID = colCheckBox(vID)
If CStr(lngID) <> "" Then
IsChecked = True
End If

exit1:

End Function

I also had to make respective change to button_click.

Thank you for all your help!
-Me
 

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