Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > Forum and Wrox.com Feedback
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Forum and Wrox.com Feedback Post your suggestions for improving the Forums or Wrox.com or questions for the staff here. "Where can I find the code for my book?"
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Forum and Wrox.com Feedback section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 18th, 2013, 10:31 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2013
Location: Canton
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL for saving record value when knowing index # of selected Recordset

I have a form that contains a ComboBox to select a CustomerName from the table CustomerHQTbl. The query includes Index, CustomerName, CustomerNumber and EstimateNumber as fields. In the AfterUpdate of the ComboBox I increase EstimateNumber by 1.

I'm brand new to this site access. I wanted to find out how I could save the updated EstimateNumber to the record set (for Index) in the CustomerHQTbl table.

Below is the code I currently have in the Company Name Combo box AfterUpdate:

Code:
    Private Sub CompanyName_AfterUpdate()

    Dim EstimateNumber As String
    Dim RecdSet As Integer

    ' Set form object values
        CSOrderCompanyName = Me!CompanyName.Column(0) 'CompanyName
        CSOrderCompanyNumber = Me!CompanyName.Column(1) ' CompanyNumber
        EstimateNumber = Me!CompanyName.Column(2) 'current EstimateNumber
        RecdSet = Me!CompanyName.Column(3) ' Index
        CSOrderEntryEstimateDate = Date
        CSOrderEntryVersions = "1"
        CSOrderEntryTypeOfPricing = "COMMERCIAL PRINTING"
        CSOrderEstimateNumber = "13-" & Right(CSOrderCompanyNumber, 5) & Right(Str(Val(EstimateNumber) + 1), 4) & "-" & CSOrderEntryVersions
    
    ' Set new estimate values in CompanyHQTbl
        Dim db As Database
        Dim rst As Recordset
        Dim ssql As String
        
        Set db = CurrentDb
        ssql = "SELECT * FROM CompanyHQTbl WHERE (Index = RecdSet)"
        Set rst = db.OpenRecordset(ssql)
        rst.MoveFirst '**** THIS IS WHERE I ERROR OUT ****
                       
        rst.Edit
        rst.Fields("EstimateNumber").Value = (Right(Str(Val(EstimateNumber) + 1), 4))
        rst.Update

Last edited by innovationsindm; April 18th, 2013 at 03:42 PM.. Reason: Adding code
  #2 (permalink)  
Old October 22nd, 2013, 02:25 AM
winwalk
Guest
 
Posts: n/a
Default

Company Name Combo box AfterUpdate:
  #3 (permalink)  
Old November 27th, 2013, 02:09 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you
  #4 (permalink)  
Old January 16th, 2014, 03:09 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you ^^'
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
find the selected index of the dropdownlist suneet.pant ASP.NET 2.0 Basics 0 May 22nd, 2008 03:45 AM
How to get datagrid selected index pl help me msrnivas General .NET 1 July 1st, 2005 08:03 AM
SQL record count / recordset chacquard Access VBA 4 July 3rd, 2004 04:41 AM
DropDownList Selected Index = -1?? dorothee ASP.NET 1.0 and 1.1 Basics 4 June 11th, 2004 03:08 AM



All times are GMT -4. The time now is 07:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.