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  dBforums > PC based Database Applications > Microsoft Access > can't requery subform

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-04, 04:17
sztomi sztomi is offline
Registered User
 
Join Date: Jan 2004
Location: Slovakia
Posts: 32
Question 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
Reply With Quote
  #2 (permalink)  
Old 01-31-04, 05:56
Norberto Norberto is offline
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
Reply With Quote
  #3 (permalink)  
Old 01-31-04, 08:00
blablast blablast is offline
Registered User
 
Join Date: Jan 2004
Location: Poland
Posts: 3
Talking Re: can't requery subform

Try:
Me.Parent.subformname.Refresh
Reply With Quote
  #4 (permalink)  
Old 01-31-04, 09:24
Norberto Norberto is offline
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
Reply With Quote
  #5 (permalink)  
Old 01-31-04, 09:28
sztomi sztomi is offline
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"
Reply With Quote
  #6 (permalink)  
Old 01-31-04, 09:37
sztomi sztomi is offline
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!
Reply With Quote
  #7 (permalink)  
Old 01-31-04, 09:40
Norberto Norberto is offline
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
Reply With Quote
  #8 (permalink)  
Old 01-31-04, 09:50
sztomi sztomi is offline
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....
Reply With Quote
  #9 (permalink)  
Old 01-31-04, 09:55
blablast blablast is offline
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
???
Reply With Quote
  #10 (permalink)  
Old 01-31-04, 10:00
Norberto Norberto is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 465
This must work:

Forms![mainform]![subform].Requery
__________________
Saludos
Norberto
Reply With Quote
  #11 (permalink)  
Old 01-31-04, 10:11
sztomi sztomi is offline
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...
Reply With Quote
  #12 (permalink)  
Old 01-31-04, 10:15
sztomi sztomi is offline
Registered User
 
Join Date: Jan 2004
Location: Slovakia
Posts: 32
Quote:
Originally posted by Norberto
This must work:

Forms![mainform]![subform].Requery
not working
Reply With Quote
  #13 (permalink)  
Old 01-31-04, 14:43
Norberto Norberto is offline
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
Reply With Quote
  #14 (permalink)  
Old 02-01-04, 07:09
sztomi sztomi is offline
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).
Attached Files
File Type: zip db2.zip (30.8 KB, 20 views)
__________________
(sz)Tomi
Reply With Quote
  #15 (permalink)  
Old 02-01-04, 07:16
Norberto Norberto is offline
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On