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 > ye ole Requery and Gotorecord thing

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-13-06, 05:29
Trinsan Trinsan is offline
Registered User
 
Join Date: Oct 2005
Posts: 168
ye ole Requery and Gotorecord thing

EDIT: Found the solution in an old database of mine... using Reorcclone and Bookmark.


Since I'm having serious strenous endeavours using the search feature, I'm hoping someone can repost from an old thread, the solution of how to return to the current record after a requery.

Observe my code:

Code:
    rek = Prod_ny!Detalje!txt_detid
            
    verdi = Prod_ny!Detalje!txt_detid
   
    pris = Beregnstortilskuer(verdi)
    
    tal = Prod_ny!Detalje!txt_id
    forestilling = Prod_ny!Detalje.Form.CurrentRecord
        
    SQL = "update md_tbl_forestilling set [pris pr tilskuer] = " & Str(pris) & " where [forestilling id] = " & Str(tal)
    DoCmd.SetWarnings False
    DoCmd****nSQL SQL
    DoCmd.SetWarnings True
    Fore_ny!subform_rettigheder.Requery

    pris = Beregnstor(verdi)

    SQL = "update md_tbl_detalje set [Beregnetpris] = " & Str(pris) & " where [detaljeid] = " & Str(verdi)
    DoCmd.SetWarnings False
    DoCmd****nSQL SQL
    DoCmd.SetWarnings True
    Prod_ny!Detalje.Requery
    DoCmd.GoToRecord acDataForm, , acGoTo, forestilling
As you can see, the form in which I have to return to the current record, is a subform. For some odd reason the GotoRecord believes the form (if name is added to the gotorecord parameters) isn't open... so I'm kinda stuck here.

The subform's data is a simple query with master/child link on an id.

Cheers, Trin
__________________
IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....

Last edited by Trinsan; 09-13-06 at 05:54.
Reply With Quote
  #2 (permalink)  
Old 09-13-06, 10:09
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
My first thought is a refresh command somewhere but I'm wondering if you can't just set the recordsource of the query on the subform = to the primary key of the main form and then instead of using gotorecord command, just set the recordsource = "queryname".
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
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