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. - Main Form (Upload) : Lets users browse and upload data. Also checks for errors. If there are errors then it opens Form 2 (Fix Errors)
- 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 -
-
...Declarations...
-
-
'Import from excel
-
If Len(strFile) > 0 Then ' strPathFile = strPath & strFile
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTable, strPath, blnHasFieldNames
-
End If
-
-
-
' Open data imported for checks
-
Set uDB = CurrentDb
-
Set rs_main = Nothing
-
Set rs_main = uDB.OpenRecordset("SELECT * FROM PROMO_DETAILS_ERROR_TABLE ORDER BY EVENT_NAME, ITEM_CODE, START_DATE")
-
-
' Checks
-
If Not (rs_main.EOF And rs_main.BOF) Then
-
Do Until rs_main.EOF = True
-
'....Multiple Checks like the one below...
-
-
'''''''''''''''' Checks : No missing Status + Status matches list + test that there is only 1 status ''''''''''''''
-
If IsNull(rs_main!Status) Then
-
rs_main.Edit
-
If IsNull(rs_main!ERROR_MSG) Then
-
rs_main!ERROR_MSG = "Missing Status."
-
Else
-
rs_main!ERROR_MSG = rs_main!ERROR_MSG & vbNewLine & "Missing Status."
-
End If
-
rs_main!LAST_UPDATE = Now()
-
rs_main.Update
-
Else
-
Set rs_status = uDB.OpenRecordset("SELECT VARIABLE_VALUE FROM AB_PROMO_APP_ALTERNATIVE_PARAMETER_REF_TABLE" & _
-
" WHERE VARIABLE = 'STATUS' AND VARIABLE_VALUE = '" & rs_main!Status & "'")
-
If rs_status.EOF Then
-
rs_main.Edit
-
If IsNull(rs_main!ERROR_MSG) Then
-
rs_main!ERROR_MSG = "Incorrect Status."
-
Else
-
rs_main!ERROR_MSG = rs_main!ERROR_MSG & vbNewLine & "Incorrect Status."
-
End If
-
rs_main!LAST_UPDATE = Now()
-
rs_main.Update
-
End If
-
End If
-
-
rs_status.Close
-
Set rs_status = Nothing
-
-
rs_main.MoveNext
-
Loop
-
-
Else
-
MsgBox "There are no records in the recordset."
-
End If
-
-
rs_main.Close 'Close the recordset
-
Set rs_main = Nothing 'Clean up
-
-
'....Some more declarations/ initializations...then the code to open form if there are no errors
-
Set rs_main = uDB.OpenRecordset("SELECT COUNT(ERROR_MSG) AS COUNT_ERROR_MSG FROM PROMO_DETAILS_ERROR_TABLE WHERE ERROR_MSG IS NOT NULL")
-
-
If rs_main!COUNT_ERROR_MSG = 0 Then
-
MsgBox "No Errors Found. Awesome!!!"
-
'Replace_Promo_Flag = 0
-
strSQL = "INSERT INTO AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE (BUSINESS_TERRITORY, INTERNATIONAL_KEY_ACCOUNT, EVENT_NAME, " & _
-
"PROMOTION_FAMILY_NAME, START_DATE, END_DATE, VISIBILITY, STATUS, ITEM_CODE, CURRENCY_ID, BASE_PRICE, DISCOUNT_VALUE, " & _
-
" ADDITIONAL_DISCOUNT_VALUE, FREE_WEEKEND_FLAG, BOGO_FLAG, UNIQUE_ID, ITEM_COUNT, LAST_UPDATE, LAST_UPDATED_BY_USER, UPDATED_FLAG) " & _
-
"SELECT BUSINESS_TERRITORY, INTERNATIONAL_KEY_ACCOUNT, EVENT_NAME, " & _
-
"PROMOTION_FAMILY_NAME, START_DATE, END_DATE, VISIBILITY, STATUS, ITEM_CODE, CURRENCY_ID, BASE_PRICE, DISCOUNT_VALUE, " & _
-
" ADDITIONAL_DISCOUNT_VALUE, FREE_WEEKEND_FLAG, BOGO_FLAG, UNIQUE_ID, ITEM_COUNT, LAST_UPDATE, LAST_UPDATED_BY_USER, UPDATED_FLAG " & _
-
" FROM PROMO_DETAILS_ERROR_TABLE"
-
uDB.Execute strSQL
-
strSQL = "DELETE * FROM PROMO_DETAILS_ERROR_TABLE"
-
uDB.Execute strSQL
-
Forms!PromoMainPageForm!TeradataSyncButton.Enabled = True
-
Else
-
DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
-
DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
-
DoCmd.OpenForm ("PromoDetailsCorrectionForm")
-
End If
-
-
DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
-
DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
-
-
uDB.Close
-
Set uDB = Nothing
-
-
End Sub
-
-
Code for Form 2 -
-
' Exactly the same as Form 1 except open recordset only shows records with error instead of everything
-
Set dcDB = CurrentDb
-
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")
-
-
' All checks same as Form 1
-
-
DoCmd.Close acTable, "PROMO_DETAILS_ERROR_TABLE"
-
DoCmd.Close acTable, "AB_PROMO_APP_ALTERNATIVE_DETAILS_TABLE"
-
-
dcDB.Close
-
Set dcDB = Nothing
-
-
End Sub
-
Thanks for your help in advance!
1 932
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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)...
|
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...
|
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...
|
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...
|
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...
|
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) {...
|
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...
|
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,...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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...
|
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...
|
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: 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...
| |