Advertisement

01.11.2008 at 02:44PM PST, ID: 23077181
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

VBA issue on click for command button and Save function

Tags: microsoft, access, 2003
I have a form that is driven by a query to display data based on a numeric value passed from a hidden form. Once my users input data into this form, in the footer of the form are a series of command buttons each driven by VBA code. One button is "Save" the other is "Open Ticket". I have included the code for both buttons below.

The problem I am having is that when the users enter the data and press "Open Ticket" sometimes and not always they system shows all the data fields as ##DELTED##. However the data was stored to the database table. The secondary code then sends a blank report to me. Also some times the form doesn't reflect the new entry and sends a blank record.

If the user inputs the data and presses "Save" then presses "Open Ticket" then the process works great 9 times out of 10. However the 1 time it doesn't the form is not storing the systemid to the table. This is how we know what type of ticket it is and it is a criteria in returning these thickets to the screen in the future.

As you can see in the code from the "Save" button and the "Open Ticket" button they both are calling for the save record the same way. However it is hit and miss if this is getting completed. I am at my wits end with this I have been looking at this and running over 100 tickets thru the system today to try and fix this. Any help would be greatly appreciated.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
---- Save command button ----
 
DoCmd.RunCommand acCmdSaveRecord
frm.Recalc 'To reset txtRecordNos
 
---- Open Ticket command button ----
 
txt_tt_sysid = Forms!frmissuesselection!txtsystemid
DoCmd.RunCommand acCmdSaveRecord
If Forms!frmissuesselection!txtsystemid = 1 Then
DoCmd.SendObject acSendReport, "rptttfssissueopen", acFormatHTML, "", "", , "New FSS Trouble Ticket # " & [Forms]![frmissues]![TroubleTicket], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 2 Then
DoCmd.SendObject acSendReport, "rptttauthissueopen", acFormatHTML, "", "", , "New Auth Ticket # " & [Forms]![frmissues]![cmdIssueNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 3 Then
DoCmd.SendObject acSendReport, "rpttttechissueopen", acFormatHTML, "", "", , "New Network Ticket # " & [Forms]![frmissues]![txtTicketNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 4 Then
DoCmd.SendObject acReport, "rptttreseissueopen", acFormatHTML, Forms!frmissues!txtresemail, Forms!frmissues!txtacctmangemail, "", [Forms]![frmissues]![txtRes] & " Reference # " & [Forms]![frmissues]![txtresissuenumber], "", False, ""
End If
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: woodje
Solution Provided By: MikeToole
Participating Experts: 2
Solution Grade: B
Views: 306
Translate:
Loading Advertisement...
01.12.2008 at 07:11PM PST, ID: 20646292

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.12.2008 at 07:12PM PST, ID: 20646295

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.13.2008 at 02:05AM PST, ID: 20647206

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.14.2008 at 07:59AM PST, ID: 20653864

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.14.2008 at 08:17AM PST, ID: 20654037

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.14.2008 at 08:47AM PST, ID: 20654298

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.14.2008 at 08:56AM PST, ID: 20654390

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.15.2008 at 10:07AM PST, ID: 20664846

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
01.12.2008 at 07:11PM PST, ID: 20646292

Rank: Master

---- Save command button ----
Sub cmdSave_Click() ' if thid id how it is
DoCmd.RunCommand acCmdSaveRecord   ' *** keep it for now
frm.Recalc 'To reset txtRecordNos
DoCmd.RunCommand acCmdSaveRecord  '**** New Line
---- Open Ticket command button ----
 
txt_tt_sysid = Forms!frmissuesselection!txtsystemid
cmdSave_Click  '******DoCmd.RunCommand acCmdSaveRecord
If Forms!frmissuesselection!txtsystemid = 1 Then
DoCmd.SendObject acSendReport, "rptttfssissueopen", acFormatHTML, "", "", , "New FSS Trouble Ticket # " & [Forms]![frmissues]![TroubleTicket], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 2 Then
DoCmd.SendObject acSendReport, "rptttauthissueopen", acFormatHTML, "", "", , "New Auth Ticket # " & [Forms]![frmissues]![cmdIssueNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 3 Then
DoCmd.SendObject acSendReport, "rpttttechissueopen", acFormatHTML, "", "", , "New Network Ticket # " & [Forms]![frmissues]![txtTicketNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 4 Then
DoCmd.SendObject acReport, "rptttreseissueopen", acFormatHTML, Forms!frmissues!txtresemail, Forms!frmissues!txtacctmangemail, "", [Forms]![frmissues]![txtRes] & " Reference # " & [Forms]![frmissues]![txtresissuenumber], "", False, ""
End If
 
01.12.2008 at 07:12PM PST, ID: 20646295

Rank: Master

I should've used Attach Code...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
---- Save command button ----
Sub cmdSave_Click() ' if thid id how it is 
DoCmd.RunCommand acCmdSaveRecord   ' *** keep it for now
frm.Recalc 'To reset txtRecordNos
DoCmd.RunCommand acCmdSaveRecord  '**** New Line
---- Open Ticket command button ----
 
txt_tt_sysid = Forms!frmissuesselection!txtsystemid
cmdSave_Click  '******DoCmd.RunCommand acCmdSaveRecord
If Forms!frmissuesselection!txtsystemid = 1 Then
DoCmd.SendObject acSendReport, "rptttfssissueopen", acFormatHTML, "", "", , "New FSS Trouble Ticket # " & [Forms]![frmissues]![TroubleTicket], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 2 Then
DoCmd.SendObject acSendReport, "rptttauthissueopen", acFormatHTML, "", "", , "New Auth Ticket # " & [Forms]![frmissues]![cmdIssueNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 3 Then
DoCmd.SendObject acSendReport, "rpttttechissueopen", acFormatHTML, "", "", , "New Network Ticket # " & [Forms]![frmissues]![txtTicketNumber], "", False, ""
End If
If Forms!frmissuesselection!txtsystemid = 4 Then
DoCmd.SendObject acReport, "rptttreseissueopen", acFormatHTML, Forms!frmissues!txtresemail, Forms!frmissues!txtacctmangemail, "", [Forms]![frmissues]![txtRes] & " Reference # " & [Forms]![frmissues]![txtresissuenumber], "", False, ""
End If
Open in New Window
 
01.13.2008 at 02:05AM PST, ID: 20647206

Rank: Guru

It's safer to refer directly to the form when saving a record rther than using DoCmd. Presuming that the cmdSave button is on the form whose data you want to save, then you can code:
---- Save command button ----
if Me.Dirty Then
   Me.Dirty = False        ' Save the changes
End If

" Which form does frm refer to in this next statement?
frm.Recalc 'To reset txtRecordNos

As echtebas says, you can call the Saver command button routine at the start of your Open Ticket code.

How does the systemID get assigned to the table before the save is run? You could put code in the form's BeforeUpdate event to make sure that it is assigned.

For clarity you can use a Select Case in your Open Ticket command code. See attached code



1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Select Case Forms!frmissuesselection!txtsystemid 
   Case 1
      DoCmd.SendObject acSendReport, "rptttfssissueopen", acFormatHTML, "", "", , "New FSS Trouble Ticket # " & [Forms]![frmissues]![TroubleTicket], "", False, ""
   Case 2
      DoCmd.SendObject acSendReport, "rptttauthissueopen", acFormatHTML, "", "", , "New Auth Ticket # " & [Forms]![frmissues]![cmdIssueNumber], "", False, ""
   Case 3
      DoCmd.SendObject acSendReport, "rpttttechissueopen", acFormatHTML, "", "", , "New Network Ticket # " & [Forms]![frmissues]![txtTicketNumber], "", False, ""
   Case 4
      DoCmd.SendObject acReport, "rptttreseissueopen", acFormatHTML, Forms!frmissues!txtresemail, Forms!frmissues!txtacctmangemail, "", [Forms]![frmissues]![txtRes] & " Reference # " & [Forms]![frmissues]![txtresissuenumber], "", False, ""
End Select
Open in New Window
Accepted Solution
 
01.14.2008 at 07:59AM PST, ID: 20653864
Mike,

The frm refers to the form. I am using a module to run several of my common command buttons at the bottom of each form. such as next record, last record, and new record. I define frm in the module to equal the form.

As to the question of how the systemid get assigned to the table is that before the save command in line #8 of my sample code you see where I assign the value to txt_tt_sysid from the form frmissuesselection and the field txtsystemid. This places the id on the record you are entering then it is saved to the table with the save command.
 
01.14.2008 at 08:17AM PST, ID: 20654037
This is going to have me pulling out what little hair I have left out. I am now getting the system to store each record correctly. I added the form recalc command to the open ticket command button. However now when the sendobject function is called they form loads the last record not the record that was just saved.

So for example if the last ticket that was entered is # 4573. When I enter the data for a new ticket and press the open ticket button the txt_tt_sysid is set to ="1" and the ticket # is 4574. Then when the sendobject is called the form steps back to ticket #4573 and sends that ticket out istead of # 4574. However in the table #4574 has been saved.

This is just going crazy.
 
01.14.2008 at 08:47AM PST, ID: 20654298

Rank: Guru

<Then when the sendobject is called the form steps back to ticket #4573 >
Do you mean that when the sendobject is finished, the form is displaying the previous record?
Put a Stop statement in the form's Current event so that you can step through to whatever caused the record movement.
 
01.14.2008 at 08:56AM PST, ID: 20654390
No when the send object begins it displays the previous record. One of the criteria in the report that is being sent is to use the record id from the open Form. So when the system is suppose to send the new record it sends the last record.
 
01.15.2008 at 10:07AM PST, ID: 20664846

Rank: Guru

Is it possible to upload a stripped-down version of your mdb? It would make it easier to figure out what's happening.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628