Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 9th, 2005, 08:16 AM
sk8ter04 sk8ter04 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 22 sk8ter04 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 40 sec
Reputation Power: 0
code help

VB Code:
Original - VB Code
  1.  
  2. Private Sub cmdSave_Click()
  3. If NoEntry = False Then         'test if data has been entered
  4.    
  5.         'take data from the screen and save to the recordset
  6.         'update mrsStudents
  7.         Dim pstSaveMsg As String        'the message to be displayed to the user
  8.         Dim pinButtons As Integer       'corresponds to type of buttons in the message eg: 4 = vbYesNo
  9.         Dim pstFindCriteria As String   'criteria to find a record
  10.         Dim pinResponse As Integer      'corresponds to the button cliked in the message
  11.        
  12. Dim prsEventNum As New ADODB.Recordset       'to load all Student IDs in tblStudents
  13. Dim pstEventNumSQL As String                 'statement to load prsAllID
  14. 'Dim pinResponse As Integer
  15.  
  16.         With mrsEvents
  17.             If mstMode = "Add" Then
  18.                 'add new record to the recordset and make it active
  19.                 .AddNew
  20.                 'create message to be displayed to the user
  21.                 pstSaveMsg = "The added record is going to be saved. " & _
  22.                              "Do you want to add new one?"
  23.                 pinButtons = 4      '4 = vbYesNo
  24.             ElseIf mstMode = "Edit" Then
  25.                 'make sure the pointer is at the record that is being edited
  26.                 pstFindCriteria = "EventNum = '" & mstEventNum & "'"
  27.                 .MoveFirst
  28.                 .Find pstFindCriteria
  29.                 pstSaveMsg = " The edited record is going to be saved."
  30.                 pinButtons = 0      '0 = vbOkOnly
  31.             End If
  32.            
  33.  
  34. 'create sql statement
  35. pstEventNumSQL = "SELECT max(tblEvents.EventNum) + 1 as maxEventNum " & _
  36.                 "FROM tblEvents"
  37.  
  38.               'open the recordset
  39. prsEventNum.Open pstEventNumSQL, gcnGiftRegistry, adOpenStatic, adLockOptimistic, adCmdText
  40.     'MsgBox prsEventNum!maxEventNum
  41.    
  42.             'read data from the form and write to the recordset - not all fields are required
  43.                 !eventNum = prsEventNum!maxEventNum
  44.                 !LastName = txtLastName.Text
  45.                 !FirstName = txtFirstName.Text
  46.                 !Street = txtStreet.Text
  47.                 !Suburb = txtSuburb.Text
  48.                 !PostCode = txtPostCode.Text
  49.                 !Phone = txtPhone.Text
  50.                 !EventDate = txtEventDate.Text
  51.                 !EventType = txtEventType.Text
  52.  
  53.             If mstMode = "Add" Then
  54.             End If
  55.             .Update
  56.             'get the updated recordset into mrsStudents
  57.             '.Requery
  58.             'Unload frmEvent
  59.             'Load frmEventGiftList
  60.             Hide
  61.             frmEventGiftList.Show 1
  62.         End With
  63.         'show the appropriate message to the user
  64.        
  65.         'pinResponse = MsgBox(pstSaveMsg, pinButtons, "Record Saved")
  66.         If pinResponse = 6 Then     'the user wants to add new record
  67.            Call SetActiveControls
  68.         Else                        'the user's finished adding/editing a record
  69.             If gstEventNum <> "" Then
  70.                 'the form was opened from frmStudentBooks
  71.                 'return to frmStudentBooks
  72.                 Unload Me
  73.             Else
  74.                 'find the edithed/added record and display it
  75.                 pstFindCriteria = "EventNum = '" & txtEventNum.Text & "'"
  76.                 mrsEvents.MoveFirst
  77.                 mrsEvents.Find pstFindCriteria
  78.                 Call DisplayData
  79.                 'set the form to the "View" mode
  80.                 mstMode = "View"
  81.                 lblheadings.Caption = "Events"
  82.                 Call ShowCommands           'show function and navigation commands
  83.                 Call SetInactiveControls    'lock textboxes
  84.             End If
  85.         End If
  86.  
  87. End If
  88.  
  89.  
  90. End Sub


can't get this to save can anyone have a check of it for me plz

Last edited by Shadow Wizard : October 9th, 2005 at 12:36 PM. Reason: added [highlight=VB] and [/highlight] code tags around code, please do that yourself next.

Reply With Quote
  #2  
Old October 9th, 2005, 12:38 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,747 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1Folding Points: 378559 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 5 h 43 m 27 sec
Reputation Power: 1914
you're being very vague... give more details please.
1. you get error? if so, post it here.
2. did you debug the code? maybe NoEntry is True, thus that whole code won't execute.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > code help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT