473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to open form2 and then return to the same previous record in form1?

547 512MB
I open a 2nd form called "Fis_StEditF" from the subform where i am currently capturing called
"[Forms]![stocktakeF]![Fis_StocktakeSF]",
using the code below, where "icn" is the same for both.

This works and i go to the correct record.

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "Fis_StEditF", acNormal, "", "[icn]=" & "" & Icn & "", , acNormal
On pressing the Close button in the "Fis_StEditF" form, i want to return to the same line (last record captured) in "[Forms]![stocktakeF]![Fis_StocktakeSF]", where i was busy capturing before i went to "Fis_StEditF"
The main "field" in "Fis_StocktakeSF" is called "item_lookup"
pls help.
Dec 17 '10 #1
1 1458
neelsfer
547 512MB
In the previous post i opened the "Fis_StEditF" form and it showed the correct record. Now I would like to return to the last record in the "Fis_StocktakeSF" where i came from, to update the current table with that last record.
I am struggling with this setfocus as it moves to the next blank record when i update via me.name = me.name function and add this blank record to the table.
I have an Id field called STId in both tables, that is the same and can be used as a reference to refer to each other.

Expand|Select|Wrap|Line Numbers
  1. Private Sub upd_Click()
  2. On Error GoTo upd_Click_Err
  3. [Forms]![stocktakeF]![Fis_StocktakeSF].SetFocus
  4. DoCmd.GoToRecord , , acLast
  5. Bincard_Total = [Forms]![stocktakeF]![Fis_StocktakeSF]![Bincard_Total]
  6. BeginStock = [Forms]![stocktakeF]![Fis_StocktakeSF]![BeginStock]
  7. FirstCount = [Forms]![stocktakeF]![Fis_StocktakeSF]![FirstCount]
  8. SecondCount = [Forms]![stocktakeF]![Fis_StocktakeSF]![SecondCount]
  9. ConfirmedCount = [Forms]![stocktakeF]![Fis_StocktakeSF]![ConfirmedCount]
  10.  
  11.     DoCmd.RunCommand acCmdRefresh
  12. upd_Click_Exit:
  13.     Exit Sub
  14.  
  15. upd_Click_Err:
  16.     MsgBox Error$
  17.     Resume upd_Click_Exit
  18.  
  19. End Sub
Dec 18 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steve Strik | last post by:
My Problem: I have created a database here at work that is exhibiting some very strange behaviour. Essentially the database is structured in a manner where one table is a master record table...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
4
by: Sender | last post by:
hello everyone i want to open form2 in modal form. how should i do that ? thanks in advance!
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
4
by: ShayHk | last post by:
I want to Open Form2 from Form1 when Button pressed. When Form2 Opens I want it to be opened in the same window..but diffrent login ... Like Explorer.
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
7
by: FNA access | last post by:
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the...
9
by: vanlanjl | last post by:
Okay lets see if I can do this with out confusing myself or others. First I will give ALL the details then state my problem and request at the bottom. Tables: tblContacts ID Company LastName...
30
by: DanicaDear | last post by:
I will search for on frmCustomers. When I find the customer, I click a button btnShowOrders and it opens frmOrders with subfrmOrderDetails2. (I'm having trouble grasping the previous sentence...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.