L
LMB
Hello Everyone,
I am just learning access but have no programming background. Using Access
2000. I have been adding components to an employee database for a long time
with the help of these groups. I have a form that I am making for data
entry and the main form has only employee name on it and is based on my
employee details table so the data entry person can pull the name up and
fill in the subform information for that person. The first subform has a
text box that is bound to EmpAudit_fkAuditID but I made it into a combo box
and instead of the ID number showing, I have the actual name of the ID in
there one name is "Blue Card". When I click in this box and select one of
the items in the list like "Blue Card", the subform below it pulls up my
Blue Card details and I can select one item at a time from the list to enter
data related to that item. Each AuditID has different items associated with
them. Right now, when I click on Blue Card, and then click on my combo box
on the subform, a list of items related to the Blue Card is displayed and I
have to select the first item and then enter the data associated with that,
then I need to click on the next combo box and select the second item
etc...until all the items have been selected. This works but I would like
to be able to have all of the items display so I don't make a mistake and
select an item twice or forget one. Would this be something I could do
using
a macro or changing the properties of the subform?
Thanks,
Linda
Here is what is in the properties of my subform.
Source Object sbfrmEmployeeAudits
Link Child Fields EmpAudit_fkEmpID
Link Master Fields strEmployeeID
When I click on the combo box which is bound to this field
EmpAudit_fkAuditID the code below runs so the proper list of items is
available on my fields on the bottom subform (at least that's what I think
it's doing). Obviously someone helped me with this and I have a teeny tiny
idea of whats going on but I wouldn't know the first thing about what to
type in there if this is what I need to do. <g>
Private Sub EmpAudit_fkAuditID_BeforeUpdate(Cancel As Integer)
Dim rstAuditDetails As Recordset
Set db = CurrentDb
Set rstAuditDetails = Me.sbfrmEmpAuditDetails.Form.Recordset
If Me.Form.NewRecord = False Then
If rstAuditDetails.RecordCount > 0 Then
MsgBox "Audit details exist - cannot change Audit type!",
vbOKOnly
Cancel = True
SendKeys "{Esc}"
Else
Me.sbfrmEmpAuditDetails.Form!EADetail_fkAItemID.Requery
End If
Else
Me.sbfrmEmpAuditDetails.Form!EADetail_fkAItemID.Requery
End If
I am just learning access but have no programming background. Using Access
2000. I have been adding components to an employee database for a long time
with the help of these groups. I have a form that I am making for data
entry and the main form has only employee name on it and is based on my
employee details table so the data entry person can pull the name up and
fill in the subform information for that person. The first subform has a
text box that is bound to EmpAudit_fkAuditID but I made it into a combo box
and instead of the ID number showing, I have the actual name of the ID in
there one name is "Blue Card". When I click in this box and select one of
the items in the list like "Blue Card", the subform below it pulls up my
Blue Card details and I can select one item at a time from the list to enter
data related to that item. Each AuditID has different items associated with
them. Right now, when I click on Blue Card, and then click on my combo box
on the subform, a list of items related to the Blue Card is displayed and I
have to select the first item and then enter the data associated with that,
then I need to click on the next combo box and select the second item
etc...until all the items have been selected. This works but I would like
to be able to have all of the items display so I don't make a mistake and
select an item twice or forget one. Would this be something I could do
using
a macro or changing the properties of the subform?
Thanks,
Linda
Here is what is in the properties of my subform.
Source Object sbfrmEmployeeAudits
Link Child Fields EmpAudit_fkEmpID
Link Master Fields strEmployeeID
When I click on the combo box which is bound to this field
EmpAudit_fkAuditID the code below runs so the proper list of items is
available on my fields on the bottom subform (at least that's what I think
it's doing). Obviously someone helped me with this and I have a teeny tiny
idea of whats going on but I wouldn't know the first thing about what to
type in there if this is what I need to do. <g>
Private Sub EmpAudit_fkAuditID_BeforeUpdate(Cancel As Integer)
Dim rstAuditDetails As Recordset
Set db = CurrentDb
Set rstAuditDetails = Me.sbfrmEmpAuditDetails.Form.Recordset
If Me.Form.NewRecord = False Then
If rstAuditDetails.RecordCount > 0 Then
MsgBox "Audit details exist - cannot change Audit type!",
vbOKOnly
Cancel = True
SendKeys "{Esc}"
Else
Me.sbfrmEmpAuditDetails.Form!EADetail_fkAItemID.Requery
End If
Else
Me.sbfrmEmpAuditDetails.Form!EADetail_fkAItemID.Requery
End If