473,383 Members | 1,952 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,383 software developers and data experts.

Navigation - refreshing data from one button to another

5
I'm just working with a small sample I built before I put this into place in my live database. Here is my problem. I have a Navigation form with two navbuttons (Part1 and Part2). Part1 form has a combo box the looks up a record and displays the results in the text boxes. If I click on the Part2 navbutton and come back to Part1 my original look up has been cleared.

I realize that because the way Navigation forms load and unload the forms this is the nature of the beast. When a user selects the the combo box on Part1 I store that ID number in a tempvars variable.

What I am trying to do is when I go back to Part1, have the tempvars variable set the ID number in the combo box and then refresh / reload / repaint the data. For the life of me I have tried everything. I tried putting code in the OnLoad, OnActivate and several other places with no luck.

Can someone show me how to do this. I figured I could do something like this:

me.comboPart=tempvars("LastPartViewed")
me.comboPart.Requery

When I go back to the Part1 navbutton, the combobox will display the correct item but the rest of the fields have not refreshed and show the first record data from the table.

I know I'm doing something wrong but don't know what.

Thanks
Jul 25 '14 #1
9 1229
twinnyfo
3,653 Expert Mod 2GB
I am madly confused....

If Part1 has a record open, what is happening with Part2 that is navigating to another record? A form does not move to a another (or a blank) record magically. You must be telling it to go somewhere....

If it is as simple as when you are on part 1 that updating the combo box will bring up the record you desire, then simply re-execute that code when you assign the correct value to the combo box:

Expand|Select|Wrap|Line Numbers
  1. Me.ComboPart_AfterUpdate
This assumes that you have code assigned to that event.....
Jul 26 '14 #2
sd1961
5
In my test database I only have the two navigation buttons. Right now Part2 doesn't even have a form to it. My working database does but I'm using this db as a test bed.

The Part1 navigation form has comboPart that looks up a recipie name and then shows data about it. So for example I pull up Chocolate Pie and it displays everything. If I click on Part2 and go back to Part1 (by default) everything is cleared. I have to re-select the Chocolate Pie.

The comboPart_AfterUpdate already has the default code to look up the record so that works when I select a new record but I want it to pull the record back up when I move to Part2 and back to Part1 navigation button. Like I said, Access closes Part1 and opens Part2 when it is clicked and then closes Part2 and opens Part1 when I come back thus the previous on screen record is cleared on Part1

I've tried using the OnLoad event to do it and I can assign the ID I want to the comboPart but when I try requerying it I just get the recipie name and the underlying record doesn't seem to refresh.

Does that make sense? If I could attach a sample I would show you but I don't think this forum has that ability.

Thanks
David
Jul 26 '14 #3
twinnyfo
3,653 Expert Mod 2GB
When you runt he code to go back to part1, then do as you have already suggested:

Expand|Select|Wrap|Line Numbers
  1. me.comboPart=tempvars("LastPartViewed")
But then, add my suggestion. This will requery the form to pull up your desired record.
Jul 26 '14 #4
sd1961
5
Ok I tried that too before and just now to make sure. I get an error "The expression you entered requires the control to be in the active window". This is after being called from the OnLoad event of the Part1 navigation form.

It is almost like it's not loaded. When it breaks at the error you can see the Navigation form is there but the Part1 and Part2 forms are not shown until click OK to acknowledge the error.

I noticed I can attach a file. I'll get a database zipped up in a bit so you can see what I'm talking about. I know Navigation forms are not like subforms but I would still think this is possible OR I'm doing something wrong.
Jul 26 '14 #5
twinnyfo
3,653 Expert Mod 2GB
How about opening Part1 from Part2 and applying a filter. This is buildin the DoCmd.Open acForm properties. Very simple to use.
Jul 26 '14 #6
sd1961
5
Ok I have attached a sample database with 4 little parts. I set the now combo0 to ID 4 when it loads and I commented out the line combo0_AfterUpdate so you won't get the error right off the bat.

So you will see going from Part1 to Part2 the combo box displays part ID 4 correctly but the underlying record is not refreshed.

If you activate the combo0_AfterUpdate line you will get the error I am getting saying the control is not in an active window.

Maybe someone will have the answer.
Attached Files
File Type: zip TestDatabase.zip (49.5 KB, 54 views)
Jul 26 '14 #7
twinnyfo
3,653 Expert Mod 2GB
Looking at your DB gave me no clue whatsoever as to what you are trying to do.... Not trying to be a jerk, or anything, I'm just confused. Unless you are publishing this to sharepoint or something like that, there is no need for a Nav Form. Just use a tab control and all your values stay in tact.
Jul 26 '14 #8
sd1961
5
Thanks. I might have to do that. Just thought this was the way to go for my application but no harm in changing it. Just would like to know if what I'm trying to do is even possible.

Thanks again for all your help.
Jul 26 '14 #9
twinnyfo
3,653 Expert Mod 2GB
Because I'm not sure what you are trying to do, I can't give you a reasonable answer.

If what you are trying to do is pull up a record under one tab, then go to another tabl and do something else, then go back to the first tab and continue with what you were doing, then, yes, you can--using a tab control.
Jul 26 '14 #10

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

Similar topics

3
by: Baby Blue | last post by:
I have 2 codes below to grap data from another site. I use them to get the data from one News site. However, when I click on some link inside (such as :...
19
by: Caesar | last post by:
Hi, I'm wondering if anyone here can point me in the right direction. My host does not provide php, and so I need to pull this data from another server that does support such scripting. Help?...
2
by: luu duong | last post by:
I know this is probably easy but here is the details. I have an asp page that is not inside a frameset. I want to post data to another asp page that is inside a frameset. So firstpage.asp has...
5
by: Vanessa | last post by:
I have a question, is that any other way to retrieve data from another webpage besides using XML object? Because I am using XML object now but give me so much problems. If I used...
1
by: David | last post by:
Hi, I have a form which requires Serial Numbers to be loaded from another form. When I press a button, another form opens with a list of Serial Numbers. I have the record selectors enabled. ...
4
by: Andrea De Santi | last post by:
How can I redirect to another page with form data? In asp Classic I write: <form ... action="filename">...</form> and in then target page I write <%=request.form("fieldname")%> ..... but in...
4
by: Peter Afonin | last post by:
Hello, I have a form with several buttons, and I need to post this data to several different applications. In ASP.NET 1.1 it was quite easy - I just used HTML controls (text or hidden), then...
9
by: sandykumar | last post by:
hiii i want to transfer data from one site to another site. there is a form in site www.abc.com and this form is similer to form of site www.xyz.com. data filled in form of site...
7
by: Boki | last post by:
Hi All, I can't pass data to another form: in form2: private void button1_Click(object sender, EventArgs e) { Form1 form_copy = new Form1();
2
by: thread | last post by:
Hi All i'm building a database in access and i want to restrict permissions. from the access i can just limit the posiblity to unhide an hidden table and in this way i can preventing the users...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.