txgeekgirl
Registered User.
- Local time
- Yesterday, 17:16
- Joined
- Jul 31, 2008
- Messages
- 187
OK - I tried to post this Monday and everyone said I needed to have bound controls. That isn't going to work with a prefilled form.
I have a form that has the following controls predefined based on a selection of a Listbox:
Me.AuditElementTB.Value = CStr(Me.ElementLB)
Me.ElementTB = DLookup("[Element]", "[FindingsElements]", "[AuditItemsID]=" & Me.AuditElementTB)
Me.SummaryTB = DLookup("[Summary]", "[Findings]", "[AuditItemID]=" & Me.AuditElementTB)
'Global Variables to push to Mandatory POI form
yestot = Me.ElementLB.Column(2)
notot = Me.ElementLB.Column(3)
natot = Me.ElementLB.Column(4)
doctotal = yestot + notot + natot
The only control the entry staff can write to on the opening form is Summary.
Then that information needs to push to the Findings TBL which I did as such...
Private Sub cmdSave_Click()
If IsNull(Me.MPOISummaryTB) Then
dummy = ReqMsg("MPOISummaryTB", "Summary")
GoTo CmdSave_ClickDone
End If
[AuditItemID] = Me.MPOIAuditItemsTB
[POIDocNum] = Me.TotalTB
[POIYes] = Me.YPercTB
[POINo] = Me.NoPercTB
[POINA] = Me.NAPercTB
[Summary] = Me.MPOISummaryTB
DoCmd.RunCommand acCmdSaveRecord
CmdSave_ClickDone:
Exit Sub
CmdSave_ClickError:
Warning Error$, "CmdSave_Click"
Resume CmdSave_ClickDone
End Sub
Three things:
1. The data will write to the table but if if the user has to post another finding it rewrites over the first entry. I did try to have it write to an intermediary table where I would then do an append or update query but it had the same issue. I would rather have it write to the Findings TBL directly.
2. The form won't close when finished. If I put in a DoCmd.Close it errors out.
3. Although the data will load for the next step (editing the POI entry with the data prefilling that has been entered), once you edit any info on the POI it resaves it to the Findings TBL as an entirely new entry - making duplicates for the basic information.
I have a form that has the following controls predefined based on a selection of a Listbox:
Me.AuditElementTB.Value = CStr(Me.ElementLB)
Me.ElementTB = DLookup("[Element]", "[FindingsElements]", "[AuditItemsID]=" & Me.AuditElementTB)
Me.SummaryTB = DLookup("[Summary]", "[Findings]", "[AuditItemID]=" & Me.AuditElementTB)
'Global Variables to push to Mandatory POI form
yestot = Me.ElementLB.Column(2)
notot = Me.ElementLB.Column(3)
natot = Me.ElementLB.Column(4)
doctotal = yestot + notot + natot
The only control the entry staff can write to on the opening form is Summary.
Then that information needs to push to the Findings TBL which I did as such...
Private Sub cmdSave_Click()
If IsNull(Me.MPOISummaryTB) Then
dummy = ReqMsg("MPOISummaryTB", "Summary")
GoTo CmdSave_ClickDone
End If
[AuditItemID] = Me.MPOIAuditItemsTB
[POIDocNum] = Me.TotalTB
[POIYes] = Me.YPercTB
[POINo] = Me.NoPercTB
[POINA] = Me.NAPercTB
[Summary] = Me.MPOISummaryTB
DoCmd.RunCommand acCmdSaveRecord
CmdSave_ClickDone:
Exit Sub
CmdSave_ClickError:
Warning Error$, "CmdSave_Click"
Resume CmdSave_ClickDone
End Sub
Three things:
1. The data will write to the table but if if the user has to post another finding it rewrites over the first entry. I did try to have it write to an intermediary table where I would then do an append or update query but it had the same issue. I would rather have it write to the Findings TBL directly.
2. The form won't close when finished. If I put in a DoCmd.Close it errors out.
3. Although the data will load for the next step (editing the POI entry with the data prefilling that has been entered), once you edit any info on the POI it resaves it to the Findings TBL as an entirely new entry - making duplicates for the basic information.