473,406 Members | 2,894 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,406 software developers and data experts.

Erratic Pop-up forms behavior ?

1
Hi All,

I am new to this forum so please pardon me if I miss anything.I am also pretty new to MS Access.
So I am sure I am doing something very stupid and just cant figure out what it is that I am doing wrong.

Context I have 2 forms.
  1. Main Form (Upload) : Lets users browse and upload data. Also checks for errors. If there are errors then it opens Form 2 (Fix Errors)
  1. Form 2 (Fix Errors) : Shows the records with errors and allows user to update incorrect data. Also checks for errors. If there are errors then it reopens Form 2 (Fix Errrors) with remaining errors.

Problem When I make a change in Form 2 (something even as small as adding a blank space in a string), the Form 2 pop up stops showing.

Code For Main Form
Expand|Select|Wrap|Line Numbers
  1.  
  2. ...Declarations...
  3.  
  4. 'Import from excel
  5. If Len(strFile) > 0 Then ' strPathFile = strPath & strFile
  6.      DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTable, strPath, blnHasFieldNames 
  7. End If
  8.  
  9.  
  10. ' Open data imported for checks
  11. Set uDB = CurrentDb
  12. Set rs_main = Nothing
  13. Set rs_main = uDB.OpenRecordset("SELECT * FROM PROMO_DETAILS_ERROR_TABLE ORDER BY EVENT_NAME, ITEM_CODE, START_DATE")
  14.  
  15. ' Checks
  16. If Not (rs_main.EOF And rs_main.BOF) Then
  17.     Do Until rs_main.EOF = True
  18.     '....Multiple Checks like the one below...
  19.  
  20.     '''''''''''''''' Checks : No missing Status + Status matches list + test that there is only 1 status ''''''''''''''
  21.             If IsNull(rs_main!Status) Then
  22.                 rs_main.Edit
  23.                 If IsNull(rs_main!ERROR_MSG) Then
  24.                     rs_main!ERROR_MSG = "Missing Status."
  25.                 Else
  26.                     rs_main!ERROR_MSG = rs_main!ERROR_MSG & vbNewLine & "Missing Status."
  27.                 End If
  28.                 rs_main!LAST_UPDATE = Now()
  29.                 rs_main.Update
  30.             Else
  31.                 Set rs_status = uDB.OpenRecordset("SELECT VARIABLE_VALUE FROM AB_PROMO_APP_ALTERNATIVE_PARAMETER_REF_TABLE" & _
  32.                                                         " WHERE VARIABLE = 'STATUS' AND VARIABLE_VALUE = '" & rs_main!Status & "'")
  33.                 If rs_status.EOF Then
  34.                     rs_main.Edit
  35.                     If IsNull(rs_main!ERROR_MSG) Then
  36.                         rs_main!ERROR_MSG = "Incorrect Status."
  37.                     Else
  38.                         rs_main!ERROR_MSG = rs_main!ERROR_MSG & vbNewLine & "Incorrect Status."
  39.                     End If
  40.                     rs_main!LAST_UPDATE = Now()
  41.                     rs_main.Update
  42.                 End If
  43.             End If
  44.  
  45.             rs_status.Close
  46.             Set rs_status = Nothing
  47.  
  48.     rs_main.MoveNext
  49.     Loop
  50.  
  51. Else
  52.    MsgBox "There are no records in the recordset."
  53. End If
  54.  
  55. rs_main.Close 'Close the recordset
  56. Set rs_main = Nothing 'Clean up
  57.  
  58. '....Some more declarations/ initializations...then the code to open form if there are no errors
  59.  Set rs_main = uDB.OpenRecordset("SELECT COUNT(ERROR_MSG) AS COUNT_ERROR_MSG FROM PROMO_DETAILS_ERROR_TABLE WHERE ERROR_MSG IS NOT NULL")
  60.  
  61. If rs_main!COUNT_ERROR_MSG = 0 Then
  62.         MsgBox "No Errors Found. Awesome!!!"
  63.         'Replace_Promo_Flag = 0
  64.         strSQL = "INSERT INTO AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE (BUSINESS_TERRITORY, INTERNATIONAL_KEY_ACCOUNT, EVENT_NAME, " & _
  65.                 "PROMOTION_FAMILY_NAME, START_DATE, END_DATE, VISIBILITY, STATUS, ITEM_CODE, CURRENCY_ID, BASE_PRICE,  DISCOUNT_VALUE, " & _
  66.                 " ADDITIONAL_DISCOUNT_VALUE, FREE_WEEKEND_FLAG, BOGO_FLAG, UNIQUE_ID, ITEM_COUNT, LAST_UPDATE, LAST_UPDATED_BY_USER, UPDATED_FLAG) " & _
  67.                 "SELECT BUSINESS_TERRITORY, INTERNATIONAL_KEY_ACCOUNT, EVENT_NAME, " & _
  68.                 "PROMOTION_FAMILY_NAME, START_DATE, END_DATE, VISIBILITY, STATUS, ITEM_CODE, CURRENCY_ID, BASE_PRICE,  DISCOUNT_VALUE, " & _
  69.                 " ADDITIONAL_DISCOUNT_VALUE, FREE_WEEKEND_FLAG, BOGO_FLAG, UNIQUE_ID, ITEM_COUNT, LAST_UPDATE, LAST_UPDATED_BY_USER, UPDATED_FLAG " & _
  70.                 " FROM PROMO_DETAILS_ERROR_TABLE"
  71.         uDB.Execute strSQL
  72.         strSQL = "DELETE * FROM PROMO_DETAILS_ERROR_TABLE"
  73.         uDB.Execute strSQL
  74.         Forms!PromoMainPageForm!TeradataSyncButton.Enabled = True
  75.     Else
  76.             DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
  77.             DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
  78.             DoCmd.OpenForm ("PromoDetailsCorrectionForm")
  79. End If
  80.  
  81. DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
  82. DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
  83.  
  84. uDB.Close
  85. Set uDB = Nothing
  86.  
  87. End Sub
  88.  
  89.  
Code for Form 2
Expand|Select|Wrap|Line Numbers
  1.  
  2. ' Exactly the same as Form 1 except open recordset only shows records with error instead of everything
  3. Set dcDB = CurrentDb
  4. Set rs_error_main = dcDB.OpenRecordset("SELECT * FROM PROMO_DETAILS_ERROR_TABLE WHERE ERROR_FLAG = -1 ORDER BY EVENT_NAME, ITEM_CODE, START_DATE, END_DATE")
  5.  
  6. ' All checks same as Form 1
  7.  
  8. DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
  9. DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
  10.  
  11. dcDB.Close
  12. Set dcDB = Nothing
  13.  
  14. End Sub
  15.  
Thanks for your help in advance!
Apr 2 '20 #1
1 932
twinnyfo
3,653 Expert Mod 2GB
abatra,

Welcome to Bytes!

1) Why do you keep closing your Tables? a) they are not being opened and b) opening a table does nothing to edit that table. These lines of code can be deleted.

2) I am not exactly sure what it is you are "trying" to do with these forms, as I see no place for the user to make updates (and you certainly ought not to have users edit the tables directly--which may be why those tables are open).

3) WHy are you using recordsets for these forms when you could just have the form bound to a table and filter the records by those that have errors?

I also see no place for your Form 2 to close and preform these checks.

A lot of confusion for me here, but I am willing to work through understanding so that we can hepp.
Apr 2 '20 #2

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

Similar topics

0
by: RookieCard | last post by:
I've been stuck on this for 2 days. Here's the deal. I am working (3 levels down/deep)in a subform within a tab object that is within another tab obeject. Everything works great! Except here: 1)...
4
by: Coy Howe | last post by:
I have popup forms with helpful hints, and I would like to determine where they will appear on the screen. Please let me how to do this. Thank you for all of your help. *** Sent via...
4
by: lauren quantrell | last post by:
I have an Access 2K popup form to which I have added buttons to run DoCmd.Maximize The problem is the form opens full height on the screen, with the bottom of the form hidden under the Windows...
0
by: dynfax | last post by:
When I use Access 97 with Terminal Services, and the terminal window is minimized, the popup form displays - and when i reset the focus to the terminal window the popup form displays. In...
1
by: apgoodb | last post by:
I have an application that uses various popup forms. All of these forms are maximized when open. When they open you can see the windows start button and quicklaunch toolbar, but after a minute or...
4
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
6
by: dhnriverside | last post by:
Hi there I'm using Windows Authentication to automatically recognise users in my web app. However, I want directory to be password protected, so if they try to visit the page in there, they MUST...
2
by: SREDWORB | last post by:
Hello, Try to explain this as best as I can. I have a main form with several cmd buttons, (Not interested in subforms for this project) that opens popup forms. Example: Main form frmPerson,...
9
by: rousseaud | last post by:
I'm having some trouble getting popup forms to work properly. I have a main form that contains 4 fields that I want to fill in by using a series of 4 popup forms that I initiate by clicking a...
4
by: ksbjr | last post by:
I have a need to arrange the relative depth of several non-modal popup forms. Specifically, I need to make sure one particular form is always at the back of the others. That is, if a user happens...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.