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

Form Requery / Refresh problem

135 100+
Hello,

I have a form with some buttons that take the user to reports, other forms, etc. On this form the user can see how many products are missing costing and pricing information, through some textboxes that i have designed with some code. The problem is that when the user opens another form, modifies products and comes back to the original form (which remains OPEN) the "status" of the missing products remain the same.

In other words, i cant find the way to refresh/requery the form and textboxes so that it checks again if products are missing. Ive tried different events with no luck...the missing products only reflect changes if the form is CLOSED AND OPENED again.

the current code is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3. Me.costingmissingtxt.Requery
  4. Me.pricingmissingtxt.Requery
  5.  
  6. If Me.costingmissingtxt.Value >= 1 Then
  7. Me.missingtxt.Visible = True
  8. Me.missingtxt.ForeColor = 255:
  9. Me.costingmissingtxt.Visible = True
  10. Me.oktxt.Visible = False
  11. Me.costingmissingtxt.ForeColor = 255
  12. Me.missingtxt.Value = "MISSING:"
  13. Else
  14. Me.costingmissingtxt.Visible = False
  15. Me.missingtxt.Visible = False
  16. Me.oktxt.Visible = True
  17. Me.oktxt.ForeColor = 65280:
  18. Me.oktxt.FontBold = True
  19. Me.oktxt.Value = "OK"
  20. End If
  21.  
  22. If Me.pricingmissingtxt.Value >= 1 Then
  23. Me.missing2txt.Visible = True
  24. Me.missing2txt.ForeColor = 255:
  25. Me.pricingmissingtxt.Visible = True
  26. Me.ok2txt.Visible = False
  27. Me.pricingmissingtxt.ForeColor = 255
  28. Me.missing2txt.Value = "MISSING:"
  29. Else
  30. Me.pricingmissingtxt.Visible = False
  31. Me.missing2txt.Visible = False
  32. Me.ok2txt.Visible = True
  33. Me.ok2txt.ForeColor = 65280:
  34. Me.ok2txt.FontBold = True
  35. Me.ok2txt.Value = "OK"
  36. End If
Any ideas if the code is flawed or where to put it???
Thanks,
Gilberto
Oct 17 '07 #1
3 2617
puppydogbuddy
1,923 Expert 1GB
try>>> Me.Requery<<<<< on the Form_AfterUpdate() event for the form (main form or actual subform (the source object, not the control) to which the selection is to be refreshed.
Oct 17 '07 #2
missinglinq
3,532 Expert 2GB
Just out of curiosity, how do you let the users know which fields need data? I use Conditional Formatting to change the BackColor to Red.

Linq ;0)>
Oct 17 '07 #3
Gilberto
135 100+
Thanks guys, i used the ACTIVE event for the form, modified the code and it WORKED hahah.

Thanks for the replies. The code that worked is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Activate()
  2. Me.Refresh
  3. Me.Requery
  4. Me.costingmissingtxt.Requery
  5. Me.pricingmissingtxt.Requery
  6.  
  7. If Me.costingmissingtxt.Value = 0 Then
  8. Me.missingtxt.Visible = False
  9. Me.missingtxt.ForeColor = 255:
  10. Me.missingtxt.Value = "MISSING:"
  11. Me.costingmissingtxt.Visible = False
  12. Me.costingmissingtxt.ForeColor = 255
  13. Me.oktxt.Visible = True
  14. Me.oktxt.FontBold = True
  15. Else
  16. Me.costingmissingtxt.Visible = True
  17. Me.missingtxt.Visible = True
  18. Me.oktxt.Visible = False
  19. Me.oktxt.ForeColor = 65280:
  20. Me.oktxt.Value = "OK"
  21. End If
  22.  
  23. If Me.pricingmissingtxt.Value = 0 Then
  24. Me.missing2txt.Visible = False
  25. Me.missing2txt.ForeColor = 255:
  26. Me.missing2txt.Value = "MISSING:"
  27. Me.pricingmissingtxt.Visible = False
  28. Me.pricingmissingtxt.ForeColor = 255
  29. Me.ok2txt.Visible = True
  30. Me.ok2txt.FontBold = True
  31. Else
  32. Me.pricingmissingtxt.Visible = True
  33. Me.missing2txt.Visible = True
  34. Me.ok2txt.Visible = False
  35. Me.ok2txt.ForeColor = 65280:
  36. Me.ok2txt.Value = "OK"
  37. End If
  38.  
  39. End Sub
Oct 17 '07 #4

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

Similar topics

4
by: Kyralessa | last post by:
In Access 2000, I have a base form with a ListBox of conference registrants. In the form's declarations section I include Dim f as Form To add a registrant I'm doing this: Set f = New...
2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
2
by: Linda | last post by:
Hi, (Access 97) On my Menu form I have a button (cmdRefreshLinks) that refreshes/changes the linked tables in my database, and a calculated control (txtDataSource) that uses a custom function...
4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
2
by: dkintheuk | last post by:
Hi all, Using Access 2000 on XP Pro PC. I have a form that is based on a presaved query - all fine with this. I also have a refresh button that takes the values from various unbound...
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
2
by: Robert | last post by:
I am trying to give the user dynamic search capabilities to select almost any record in the database from criteria they select. Everything seems to work except when I open the display form to...
34
by: bitsnbytes64 | last post by:
Hi, I've been having a similar issue to what is described in the "refresh a form" post with a ComboBox that is not being refreshed after adding a new value on a seperate form. The second form is...
5
kcdoell
by: kcdoell | last post by:
Hello: I thought I was done with this one but a user who is testing my DB just pointed out a problem. I used the following in the afterupdate event: Private Sub...
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: 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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.