Recent content by scottn

  1. S

    Sending Esc key using Visual Basic

    Glad you found a solution. :) But, I think the changes really are getting written out to the table before the close event. You can build a little test form to see what I mean. Bind the form to a table and make a couple text boxes so you can dirty the form. Include a button on the form...
  2. S

    Tbles, Records, Code

    Hi Mara, There's a variety of ways to do both, of course. To insert new records using ADO, you can do something like this: Dim rst as ADODB.Recordset Set rst = New ADODB.Recordset 'Instantiate a new recordset With rst .Open "myTable", CurrentProject.Connection, adOpenDynamic 'Open...
  3. S

    Sending Esc key using Visual Basic

    I think your actual problem may be that the changes to data are committed long before the form's close event fires. You can also discard changes to data from VBA by calling the form's Undo method, but a quick test reveals that calling Undo in the close event has no effect. In fact, I traced...
  4. S

    Priority Ranking

    you want to change the ranking of an item from n to m. i guess you could look at it like this. there are two cases: 1. you're moving the item up (higher priority) in the ranking. in this case, n > m. in this case, you have to do these steps: - take all the items ranked m to n-1 and bump...
  5. S

    Syntax for referring to a variable Field name

    you know, the following actually works fine -- the integer is implicitly cast to a string before the concatenation. Dim SomeInt as Integer Dim SomeString as String Dim AnotherString as String AnotherString = SomeString & SomeInt 'works fine -- implicit cast if you want to be explicit...
  6. S

    Syntax for referring to a variable Field name

    that error message is usually an indication that the named field doesn't exist in your recordset. are you sure the string you're building matches the field name exactly? also, check the routine in which you're opening the source recordset to make sure that the recordset you're opening actually...
  7. S

    Syntax for referring to a variable Field name

    you're on the right track. a recordset has a Fields collection, and you can use a string which matches the field name to indicate the field you're interested in. something like this: 'Build the field name as you would any string strFieldName = "SkillSet" & SomeInteger 'Then use it to...
  8. S

    Condition Syntax

    I usually define this little function somewhere in my project: Public Function IsOpen(strName As String, Optional intType As AcObjectType = acForm) 'From: Getz, Litwin, Gilbert. Access 200 Delevoper's Handbook Volume 1: Desktop Edition. 1999, Sybex. 'Returns true if the form is open...
  9. S

    Retrieving all records for Quarter/Half/Year

    On your form, make a drop-down for the user to select the quarter they want (let's call it cmbPeriod). Set the Row Source Type property to "Value list". In the Row Source property you'll enter a list of values like: "Quarter 1";"Quarter 2";"Quarter 3";"Quarter 4" The quotes are important --...
  10. S

    Find syntax for ADO

    Ashik & Mile, Can you guys bring me up to date on the ADO vs. DAO thing? I have been using ADO w/ Access 2000 for years. When A2K came out I understood that the official line from Microsoft was that ADO was the way of the future. The development of ADO.NET, I thought, kind of confirmed that...
  11. S

    Retrieving all records for Quarter/Half/Year

    You can use a where clause in a SQL query to filter the proper records. It would go something like this: SELECT ...... FROM ...... WHERE ExpirationDate >= #1/1/04# AND ExpirationDate <= #3/31/04# That would get you everything that expired in the first quarter. Obviously you'll need to...
  12. S

    gather e-mail addresses...

    try these corrections: Private Sub cmdSaveMail_Click() Dim db As DAO.Database Dim rst As DAO.Recordset Dim Recipients as String Set db = currentdb() Set rst = db.OpenRecordset("tbltmpRecipients", dbOpenDynaset) rst.MoveFirst Recipients = rst.Fields("TotalRecipients") rst.MoveNext Do While...
  13. S

    gather e-mail addresses...

    Do you just need to get all the addresses concatenated into a comma-delimited string? & is the string concatenation operator in VBA. Your addresses are in a table... so I assume you're opening a recordset. So you'd need to loop through the recordset and concatenate the string together...
  14. S

    Find syntax for ADO

    Ashik, Actually Mile-O-Phile is absolutely right about this: I was just pointing out the reason why your attempt to use the single quote ' wasn't working.
  15. S

    Conditional Formatting & Exporting Access 97 query result to Excel 2000

    Excel has a rich object model and is pretty easy to automate from VBA in access. You'll need to add a reference to the Excel object library from Tools->References in the VBE. Once you've done that, you can use the Object Browser (F2) and Help to dig into Excel's object model... it's extensive...
Back
Top Bottom