Question about Sub Form Coding

D

dbain30

I have a Form titled "Customer Form" and a sub form titled "Order
Form". The Order Form is continious and list the individual orders for
the particular customer.

In the subform I have a button that when pressed will insert the
current date and user ID into two fields. So far this works great
except that now I want to disable the button so that it cannot be
pressed again, either while it is currently open or when it is opened
again. Also, since this is a continious subform, I don't want the
button to disappear for the orders before or after it for the
particular customer.

I'm using Access 97 and have tried various things but so far with
little success. Any suggestions would be greatly appreciated.
 
D

dbain30

Just an update.

I have this working. I created a checkbox on the form that isn't
visible. When the button is clicked it populates the checkbox and
places the date and user info in the fields. That is working
perfectly.

The issue that I'm still having is that I put this code in the
OnCurrent level of the form. It works except that the subform is
continious and it follows the logic of the first item on the orders
list. If the checkbox is checked on the first order, it is locked for
all of the orders for that customer. I need to limit this to just the
one record.

Private Sub Form_Current()
If Me![ApprovalLock] = -1 Then
Me![ApprovalButton].Enabled = False
Else
Me![ApprovalButton].Enabled = True
End If
End Sub

Again, any help would be greatly appreciated!
 
A

Al Campagna

dbain,
Sounds like your checkbox is "unbound"... not associated with a boolean field in your
table via the ControlSource.
Add a boolean field (ex. Lock) to your subform table, include it in the query behind
the form, and set your checkbox ControlSource to Lock.
Now, each record can "hold" it's own Lock value.
--
hth
Al Campagna
Candia Computer Consulting
Microsoft Access MVP - Candia, NH USA
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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