Search results

  1. R

    vba code only works in debug mode

    The data type for App1 is String.
  2. R

    vba code only works in debug mode

    App1 is just one of 90 different applications that I need to store estimates (hours) for. In the code I've pasted here, I've only included App1 instead of all 90. The code for each is the same. The problem is the DoCmd.RunSQL statement that inserts the '0'. I don't understand why it does...
  3. R

    vba code only works in debug mode

    I'm trying to insert a '0' into my table named [tbl_RIF-App Info]. The code works in debug mode just fine but when I run it outside of debug, the '0' does not get inserted. Even stranger, if I run a compact and repair and then run my code without debug mode, the '0' gets inserted?? I can't...
  4. R

    ActiveX Component Can't Create Object Error

    Set appWord = CreateObject ("Word.Application") worked!! Thank you. I meant I was copy the entire database (front end and data) over to a shared network drive vs. my hard drive.
  5. R

    ActiveX Component Can't Create Object Error

    My database works just fine on my hard drive but when I go to run it on the server, I receive the error: 'ActiveX Component Can't Create Object' Here's the line of code that triggers the error: Set appWord = GetObject(, "Word.Application") Any suggestions for this? I don't own the...
  6. R

    Do While Loop

    You all provided excellent feedback. This is a database I inherited so it's very un-normalized. I'm doing my best to clean it up w/o affecting the table structure too much. I was able to get the for loop to work as suggested which really cuts down on the amount of code to maintain. Thanks again.
  7. R

    Do While Loop

    I'd like to create a Do While loop to help make my code a lot thinner. Below is the code I'm working with now. I currently have App1 - App90 and it continues to grow. I'd like to perform a Do While loop but I'm not sure how to accomplish this. App1 - 90 are all string values. If...
  8. R

    Using a variable in a recordset If statement

    Thanks again! That worked!!!
  9. R

    Using a variable in a recordset If statement

    Yes, I have over 100 apps in my database and I reference the fields throughout the code. Sometimes these app names can change so I have them all defined as Public string variables: For example: Public App1 As String App1 = "BDS-ST"
  10. R

    Using a variable in a recordset If statement

    I tried your code but it throws a Run-Time error '3126': Invalid bracketing of name '[]'. I've tried a few more variations but can't get it to work...
  11. R

    Using a variable in a recordset If statement

    Ah, Gotcha...I removed the .Result. Hmmm...now I'm trying to run an Update SQL statement using that same variable App1. It doesn't like it when I don't use any quotes around it so I tried several combos but can't get it to run: Here's my latest attempt: 'DoCmd.RunSQL "UPDATE [tbl_RIF-App...
  12. R

    Using a variable in a recordset If statement

    Just App1 worked. Thanks!!!
  13. R

    Using a variable in a recordset If statement

    I'm trying to pass a variable in an If statement within a recordset. If I explicitly enter the variable value, the code works fine. I've tried several variations to try and properly reference the variable 'App1'. Here's my latest snippet of code that shows my problem: With rst If...
  14. R

    Code to update table value based on another value

    I'm trying to update a table value based on another value in the same table. Here's the scenario: In the table I have 3 estimate descriptions: Sizing, Planning and Commitment. Each description is tied to a series of numbers representing estimates across different teams. For example...
  15. R

    Using .AddNew with ADO but cannot update the new record immediately

    I tried that (revised code below) but it netted the same result with 0 rows updated. Like you said, somehow it's not committing these 3 new rows to the table so it can't find them to run the update. I tried the .MoveLast / .MoveFirst once and then added after each .AddNew but it gave the...
  16. R

    Using .AddNew with ADO but cannot update the new record immediately

    Thanks for noticing that extra .Update. I took it out but same result. Yes, I stepped though it and it doesn't find a match in the table based on my WHERE clause. So I tested it further by hard coding the previous record number in the table instead of the value of & DM for the current record...
  17. R

    Using .AddNew with ADO but cannot update the new record immediately

    Ok, I tried that but it still didn't update the 3 new records. How frustrating! Here's my revised code: rst.Open "[tbl_RIF-App Info]", cnn, adOpenKeyset, adLockOptimistic With rst FirstApp = "Yes" .AddNew ![DM #] = DM ![Estimate_Type] = "Sizing" .Update .AddNew...
  18. R

    Using .AddNew with ADO but cannot update the new record immediately

    I'm using .AddNew to add 3 new records to my table (which it does perfectly). After I add these 3 records, I want to run an update on one field using DoCmd.RunSQL. When I run this though, I get '0 records updated'. It will not allow me to update these records right after I've added them. I'm...
Back
Top Bottom