Re: combine codes
- From: Levans digital <Levansdigital@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 19 Jun 2006 06:55:02 -0700
Ahh Marshall,
Sorry for late response but my computer was down. I tried your suggestions
and yes you are so correctl it works the way I wanted it.
Thanks very much.
I posted the following question previously but would like a second opinion
on it.
I have a Main Invoice Form (InvoiceFrm) and Subform (InvoiceDetailsFrm)
The subform which is continuous has a checkbox "Delivered" on each line item
to Make 3 additional fields "Land", "Water", and "Air" Visible/Not Visible.
It works. However instead of showing/hiding only these fields on that
specific line item it show/hide all line items in the subform.
What can I do to fix this please help!
"Marshall Barton" wrote:
Ahh yes, "refresh" the form, not the combo box. In this.
case the line of code should be:
Me.Requery
What I had before would just "refresh" the combo box, which
wasn't what you wanted. Sorry if the right answer is even
shorter than the wrong answer ;-)
Note that the wizard generated code is really only doing
that one thing. The rest of the code was just the standard
error handling code that should be included in every
procedure.
The Requery method reloads all of the form's data from its
record source query. Refresh only checks if any of the
form's records were modified by another user. Modified
records will be refreshed, deleted records will show in the
form as "Deleted", but new records will not be included in
the refreshed dataset. Bottom line, Refresh is rarely
useful. OTOH, Requery is very popular, especially if the
form's record source query's criteria is changed (which I
suspect is the purpose of the combo box).
--
Marsh
MVP [MS Access]
Levans digital wrote:\
Yes that code is to refresh the FORM once the "Location" combo has been
updated.
Is refresh and requety the same?
So I can replace all that refresh code with the short requery code?
"Marshall Barton" wrote:
Levans digital wrote:
Code (1) Created by wizard to refresh the “Location” combobox
Private Sub Location_AfterUpdate()
On Error GoTo Err_Refresh__Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Refresh__Click:
Exit Sub
Err_Refresh__Click:
MsgBox Err.Description
Resume Exit_Refresh__Click
End If
End Sub
Code (2)
Private Sub Location_AfterUpdate()
If Not IsNull(Me![Location]) Then
Me![CargoTallyID] = [Forms]![CargoTallyfrm].[CargoTallyID]
ElseIf IsNull(Me![Location]) Then
Me![CargoTallyID] = Null
End If
End Sub
Both these codes work great when used individually, however because the
“Location” afterupdate event will trigger both I need to to combine them into
one please help.
I can't rememberwhat that archaic A2 wizard code is doing, a
"Refresh"?
Although I don't understand why you think you need to
"refresh" the combo box, I think you might want to add:
Me.Location.Requery
to the end of your second procedure.
- Follow-Ups:
- Re: combine codes
- From: Marshall Barton
- Re: combine codes
- References:
- Re: combine codes
- From: Marshall Barton
- Re: combine codes
- From: Marshall Barton
- Re: combine codes
- Prev by Date: Re: What programme opens files in Microsoft Access XP?
- Next by Date: Re: Updating form based on 2 fields.
- Previous by thread: Re: combine codes
- Next by thread: Re: combine codes
- Index(es):
Relevant Pages
|
Loading