| |
|
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.
|
 |
|

01-31-04, 04:17
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
can't requery subform
|
|
Hello,
please help me solve my problem...
I have a mainform with one subform, which (subform) is based on a similar query: "SELECT a,b,c,stop FROM table WHERE stop=false". In the "On Delete" event of the subform I placed the following code:
Cancel = True
If Me.SelHeight = 1 Then
Me.stop = True
DoCmd****nCommand acCmdSaveRecord
Me.Parent.subformname.Requery
End If
...because I don't want any deleted records - only "stopped". After executing this code (from
|
|

01-31-04, 05:56
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
I thing you have a problem because the users can select more than one record at the same time and then your code don't work fine.
My be is better set the property AllowDeletions to No, show in the subform the field stop and make that the users activate the stop.
Use a code in event AfterUpdate for see that situacion and make the requery.
__________________
Saludos
Norberto
|
|

01-31-04, 08:00
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Poland
Posts: 3
|
|
Re: can't requery subform
|
|
Try:
Me.Parent.subformname.Refresh
|
|

01-31-04, 09:24
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
You have the Focus in the Subform that is the problem with the requery of the main form.
Prube with this:
Me.Parent.subformname.SetFocus
Me.Requery
__________________
Saludos
Norberto
|
|

01-31-04, 09:28
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Thank's for your answers
Norberto: Yes, my users can select more than one row, but in this case my procedure is not executing, cause the "If Me.SelHeight = 1 Then ... End If" in my code... The other problem is I don't want my users to know what is happening on the "background" - for him, this must look like simple deletion of a record.
blablast: the "refresh" method raises an error message: "Object doesn't support this property or method"
|
|

01-31-04, 09:37
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Quote:
Originally posted by Norberto
You have the Focus in the Subform that is the problem with the requery of the main form.
Prube with this:
Me.Parent.subformname.SetFocus
Me.Requery
|
No, my focus is still remaining on subform and I need requery the subform, not the mainform!
|
|

01-31-04, 09:40
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
Quote:
Originally posted by sztomi
Thank's for your answers
Norberto: Yes, my users can select more than one row, but in this case my procedure is not executing, cause the "If Me.SelHeight = 1 Then ... End If" in my code... The other problem is I don't want my users to know what is happening on the "background" - for him, this must look like simple deletion of a record.
blablast: the "refresh" method raises an error message: "Object doesn't support this property or method"
|
Ok .... now i understand what you want.
For the requery make this:
You have the Focus in the Subform that is the problem with the requery of the main form.
Prube with this:
Me.Parent.subformname.SetFocus
Me.Requery
__________________
Saludos
Norberto
|
|

01-31-04, 09:50
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Quote:
Originally posted by Norberto
Ok .... now i understand what you want.
For the requery make this:
You have the Focus in the Subform that is the problem with the requery of the main form.
Prube with this:
Me.Parent.subformname.SetFocus
Me.Requery
|
Thus once again: I have my custom deletion code in the On Delete event of the SUBFORM, thus I need requery the subform! With the above code I get a very exciting error: "Reserved Error", but never mind, because it requeries the main form, that I don't need....
|
|

01-31-04, 09:55
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Poland
Posts: 3
|
|
Quote:
Originally posted by sztomi
Thus once again: I have my custom deletion code in the On Delete event of the SUBFORM, thus I need requery the subform! With the above code I get a very exciting error: "Reserved Error", but never mind, because it requeries the main form, that I don't need....
|
So , can you use just:
Me.Requery
or try
Me.Refresh and next Me.Repaint
???
|
|

01-31-04, 10:00
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
This must work:
Forms![mainform]![subform].Requery
__________________
Saludos
Norberto
|
|

01-31-04, 10:11
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Quote:
Originally posted by blablast
So , can you use just:
Me.Requery
or try
Me.Refresh and next Me.Repaint
???
|
Hmmm, it's very interesting: after my code executes, if I manually place a focus on a control on the main form, then select Refresh from the Access' Records menu, the stopped row (on the subform) is not showing already! But if I code this step into my procedure
Me.Parent.somecontrol.setfocus
Me.Parent.Refresh
... it doesn't help! Neither the methods Repaint or Requery...
|
|

01-31-04, 10:15
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Quote:
Originally posted by Norberto
This must work:
Forms![mainform]![subform].Requery
|
not working
|
|

01-31-04, 14:43
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
Now is a question of honor send an sample base in Access 97 format
for see what is the problem.
__________________
Saludos
Norberto
|
|

02-01-04, 07:09
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Slovakia
Posts: 32
|
|
Quote:
Originally posted by Norberto
Now is a question of honor send an sample base in Access 97 format
for see what is the problem.
|
Sorry, I can't convert my database to Access 97's format, during the conversion it gives me an error message "Invalid filed data type". So the attached db2.mdb is in Access 2000 format (converted from Access 2002).
__________________
(sz)Tomi
|
|

02-01-04, 07:16
|
|
Registered User
|
|
Join Date: Aug 2003
Location: Argentina
Posts: 465
|
|
I have Access 97 not Access 2000, then i can't read that file.
__________________
Saludos
Norberto
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|