Access Access 2007 Coding

Status
Not open for further replies.
Joined
May 11, 2009
Messages
1
Reaction score
0
I am trying to make a button on a form ("StockEntry") subtract quantities of certain items from the inventory sheet ("Supplies") In addition, I am trying to make it so that once the button is pressed, the fields that it looks at are locked for editing and the button cannot be pushed more than once.

I have tried the code below, and VB6 wont even step through the code nor tell me what is wrong.

I think my problem has to do with "activating" the associated tables but I don't know how I would do that.

I have very limited experience but want to learn, so please try to keep the comments helpful, but dont expect me to know very much about the actual code.

Can someone please help me fix this/guide me in the right direction?

Code:
Private Sub Command21_Click()
If (Not IsNull(Form_StockEntry.Production_Date)) Then

If Form_StockEntry.Quantity_Subtracted = "False" Then

' Color
' Comes from a Drop Down Menu

If Form_StockEntry.Color = "Red" Then
Tables!Supplies.Quantity(2) = Tables!Supplies.Quantity(2) - 1
ElseIf Form_StockEntry.Color = "Oak" Then
Tables!Supplies.Quantity(3) = Tables!Supplies.Quantity(3) - 1
ElseIf Form_StockEntry.Color = "White" Then
Tables!Supplies.Quantity(4) = Tables!Supplies.Quantity(4) - 1
Else
End If

' Locking Device
' Comes from a Drop Down Menu

If Form_StockEntry.Locking_Device = "Mag Lock" Then
Tables!Supplies.Quantity(6) = Table_Supplies.Quantity(6) - 1
ElseIf Form_StockEntry.Locking_Device = "Pin Lock" Then
Tables!Supplies.Quantity(7) = Table_Supplies.Quantity(7) - 1
End If

' Hose
' Comes from a check box

If Form_StockEntry.Extra_Hose = "Yes" Then
Tables!Supplies.Quantity(5) = Table_Supplies.Quantity(5) - 2
Else
Tables!Supplies.Quantity(5) = Table_Supplies.Quantity(5) - 1
End If

' Locking
' This section is designed to lock associated fields

Set Tables!Stock!Quantity_Subtracted.Locked = True
Set Tables!Stock!Color.Locked = False
Set Tables!Stock!Locking_Device.Locked = False
Set Tables!Stock!Extra_Hose.Locked = False
Set Tables!Stock!Quantity_Subtracted.Value = True
Set Tables!Stock!Quantity_Subtracted.Locked = False
Else
End If
GoTo LineAAA
Else
End If
LineAAA:
End Sub
 
Joined
Jan 14, 2006
Messages
12,268
Reaction score
283
You will probably get helper quicker on a dedicated Access Forum than here on a General Computer Forum.:thumb:
As their may not be that many people here to help you, Sorry.
 
Joined
May 26, 2010
Messages
2
Reaction score
0
hi, I am new here, happy to meet you all ..
No one can teach me the basic coding for a form ..

please email to (e-mail address removed)

please help me ..
I appreciate your help
thank you friends

i using MS access 2003 software
 
Status
Not open for further replies.

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