A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

form doesn't update!!!!!



 
 
Thread Tools Display Modes
  #1  
Old June 11th, 2004, 06:11 AM
manish
external usenet poster
 
Posts: n/a
Default form doesn't update!!!!!

I have a form setup having a sub-form which is not the
case of a problem. However i have another form in the
header section which lists only one field (the last
invoice no - raised) from a query. This field is only for
information purpose - so that i can know the next number
to be put on the invoice.
Once the main form is loaded it shows the correct no -
that is the last invoice no. But when i go on adding the
records the field is not updated. Only when i exit the
form and start again does it show the correct invoice no.
I also do not want to put it in my tab order - i.e. I do
not want it to gain focus.
Any way around for these!!!! Please advice..
VBA coding is not my cup of tea.
thanks
-----manish---
  #2  
Old June 11th, 2004, 06:36 AM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default form doesn't update!!!!!

"manish" wrote in message

I have a form setup having a sub-form which is not the
case of a problem. However i have another form in the
header section which lists only one field (the last
invoice no - raised) from a query. This field is only for
information purpose - so that i can know the next number
to be put on the invoice.
Once the main form is loaded it shows the correct no -
that is the last invoice no. But when i go on adding the
records the field is not updated. Only when i exit the
form and start again does it show the correct invoice no.
I also do not want to put it in my tab order - i.e. I do
not want it to gain focus.
Any way around for these!!!! Please advice..
VBA coding is not my cup of tea.
thanks
-----manish---


Is this a subform in the form's header, or a text box that uses a
DLookup? Whichever it is, probably you need to explicitly requery it
whenever you add or delete records. The code would be something like

Me!NameOfControl.Requery

where "NameOfControl" is the name of the subform control (on the main
form), if that's what it is, or the name of the text box.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old June 11th, 2004, 06:52 AM
manish
external usenet poster
 
Posts: n/a
Default form doesn't update!!!!!

Dear Dirk,
It is another form that is not linked to the main form but
it contains a text box which shows information from a
query. Also where should i put this little code which u
have provided.
Also thanks a lot for posting ur reply so fast.
manish

-----Original Message-----
"manish" wrote in

message

I have a form setup having a sub-form which is not the
case of a problem. However i have another form in the
header section which lists only one field (the last
invoice no - raised) from a query. This field is only

for
information purpose - so that i can know the next number
to be put on the invoice.
Once the main form is loaded it shows the correct no -
that is the last invoice no. But when i go on adding the
records the field is not updated. Only when i exit the
form and start again does it show the correct invoice

no.
I also do not want to put it in my tab order - i.e. I do
not want it to gain focus.
Any way around for these!!!! Please advice..
VBA coding is not my cup of tea.
thanks
-----manish---


Is this a subform in the form's header, or a text box

that uses a
DLookup? Whichever it is, probably you need to

explicitly requery it
whenever you add or delete records. The code would be

something like

Me!NameOfControl.Requery

where "NameOfControl" is the name of the subform control

(on the main
form), if that's what it is, or the name of the text box.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.

  #4  
Old June 14th, 2004, 07:21 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default form doesn't update!!!!!

"manish" wrote in message

Dear Dirk,
It is another form that is not linked to the main form but
it contains a text box which shows information from a
query. Also where should i put this little code which u
have provided.
Also thanks a lot for posting ur reply so fast.
manish

-----Original Message-----
"manish" wrote in message

I have a form setup having a sub-form which is not the
case of a problem. However i have another form in the
header section which lists only one field (the last
invoice no - raised) from a query. This field is only for
information purpose - so that i can know the next number
to be put on the invoice.
Once the main form is loaded it shows the correct no -
that is the last invoice no. But when i go on adding the
records the field is not updated. Only when i exit the
form and start again does it show the correct invoice no.
I also do not want to put it in my tab order - i.e. I do
not want it to gain focus.
Any way around for these!!!! Please advice..
VBA coding is not my cup of tea.
thanks
-----manish---


Is this a subform in the form's header, or a text box that uses a
DLookup? Whichever it is, probably you need to explicitly requery it
whenever you add or delete records. The code would be something like

Me!NameOfControl.Requery

where "NameOfControl" is the name of the subform control (on the main
form), if that's what it is, or the name of the text box.


I'm not sure what you mean when you say "It is another form that is not
linked to the main form", but I think you mean that it is a subform on
the main form with no Link Master/Child Fields. That means that the
form object is actually displayed in a subform control on the main form.

Suppose that subform control is named "sfLastInvoiceNo". You would put
the code to requery it in both the AfterInsert and AfterDelConfirm
events of whatever form is being used to add invoices. It isn't clear
from your description whether this is the main form itself, or another
subform on that form.

If it's the main form itself, you would add event procedures like these
to the main form:

Private Sub Form_AfterInsert()
Me!sfLastInvoiceNo.Requery
End Sub

Private Sub Form_AfterDelConfirm()
Me!sfLastInvoiceNo.Requery
End Sub

(Note: if you don't allow invoices to be deleted, you don't need to use
the AfterDelConfirm event.)

If, on the other hand, the invoices are being added on a subform of the
main form -- the same main form that also contains sfLastInvoiceNo --
then you have to go up through the subform's Parent property to the main
form, like this:

Private Sub Form_AfterInsert()
Me.Parent!sfLastInvoiceNo.Requery
End Sub

Private Sub Form_AfterDelConfirm()
Me.Parent!sfLastInvoiceNo.Requery
End Sub

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #5  
Old June 15th, 2004, 11:24 AM
manish
external usenet poster
 
Posts: n/a
Default thanks!

Dear Dirk,
Thank U Very Very much. Your solution really worked for me.
If really it weren't for U people, people like us would
have died of frustation. thank U for ur response.
manish


-----Original Message-----
"manish" wrote in

message

Dear Dirk,
It is another form that is not linked to the main form

but
it contains a text box which shows information from a
query. Also where should i put this little code which u
have provided.
Also thanks a lot for posting ur reply so fast.
manish

-----Original Message-----
"manish" wrote

in message

I have a form setup having a sub-form which is not the
case of a problem. However i have another form in the
header section which lists only one field (the last
invoice no - raised) from a query. This field is only

for
information purpose - so that i can know the next

number
to be put on the invoice.
Once the main form is loaded it shows the correct no -
that is the last invoice no. But when i go on adding

the
records the field is not updated. Only when i exit the
form and start again does it show the correct invoice

no.
I also do not want to put it in my tab order - i.e. I

do
not want it to gain focus.
Any way around for these!!!! Please advice..
VBA coding is not my cup of tea.
thanks
-----manish---

Is this a subform in the form's header, or a text box

that uses a
DLookup? Whichever it is, probably you need to

explicitly requery it
whenever you add or delete records. The code would be

something like

Me!NameOfControl.Requery

where "NameOfControl" is the name of the subform

control (on the main
form), if that's what it is, or the name of the text

box.

I'm not sure what you mean when you say "It is another

form that is not
linked to the main form", but I think you mean that it is

a subform on
the main form with no Link Master/Child Fields. That

means that the
form object is actually displayed in a subform control on

the main form.

Suppose that subform control is named "sfLastInvoiceNo".

You would put
the code to requery it in both the AfterInsert and

AfterDelConfirm
events of whatever form is being used to add invoices.

It isn't clear
from your description whether this is the main form

itself, or another
subform on that form.

If it's the main form itself, you would add event

procedures like these
to the main form:

Private Sub Form_AfterInsert()
Me!sfLastInvoiceNo.Requery
End Sub

Private Sub Form_AfterDelConfirm()
Me!sfLastInvoiceNo.Requery
End Sub

(Note: if you don't allow invoices to be deleted, you

don't need to use
the AfterDelConfirm event.)

If, on the other hand, the invoices are being added on a

subform of the
main form -- the same main form that also contains

sfLastInvoiceNo --
then you have to go up through the subform's Parent

property to the main
form, like this:

Private Sub Form_AfterInsert()
Me.Parent!sfLastInvoiceNo.Requery
End Sub

Private Sub Form_AfterDelConfirm()
Me.Parent!sfLastInvoiceNo.Requery
End Sub

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.