Search results

  1. N

    Calculate a text box from two other text boxes

    In your VBA Editor, on the top menu, choose "Debug". The first drop-down item should be "Compile ".
  2. N

    Question Mute all sounds

    I'm not sure if you can edit VBA using VBA. Instead, I would have the button set a value somewhere, either a global variable/switchboard textbox or a table depending on whether you want this setting to be saved for this session or all sessions. The value just needs to be a True/False value where...
  3. N

    Question DLookup and Date problems - please help

    For getting workdays, DateAdd doesn't seem to work in my experience. Here's a bit of code I just made up. It doesn't take into account holidays though, as that would require quite a bit more work that the OP may or may not need. I only tested it a bit, but so far it seems to work. I'll leave it...
  4. N

    Question Editting date value

    In this case, it does require it since it's building the SQL string. If you just do "Set [InstallationDate] = " & Date, the actual SQL will appear asSet [InstallationDate] = 12/12/2012 which updates the table with a default time. That is what has occured with the OP. @OP, it should be:strSQL...
  5. N

    Question Editting date value

    What does your SQL statement look like? It should be similar to this Function ChangeDate() Dim strSQL As String strSQL = "UPDATE [tablename] SET [datefield] = #" & Date & "# WHERE [datefield] = #01/01/1990#" Debug.Print strSQL CurrentDb.Execute strSQL, dbFailOnError End Function
  6. N

    Trim/Remove line breaks from every field in every record

    Yup, I know about that article. The reason for my confusion was partly due to the fact that I'm accessing field names through variables rather than discrete names like what is shown in the article. Anyway, I tried out my code and it works, so that's good. I think I'm using it. Surrogate key is...
  7. N

    Trim/Remove line breaks from every field in every record

    Thanks for the responses. @mdlueck For passing the fld variable into the recordset, would this be the right code? r(fld.name) = fld @DJkarl That's interesting. I might use that approach once I get my method working. I want to take time to understand fully your code before putting it into use...
  8. N

    Adding and multiplying multiple combo and text boxes

    If you have a limited number of items to perform your arithmetic operations, the simple way is just to do something like this: Dim Result as Double If Not IsNull(cbo1) Then Result = cbo1 Else Result = 0 If Not IsNull(txt2) Then Result = Result + txt2 End If If Not IsNull(txt3) Then Result =...
  9. N

    Painful InputMasks

    Personally, I like to separate Date and Time into two fields just to save myself from these types of complications. Not sure if that's an option for you?
  10. N

    Question Two divisions but one set of database objects, How?

    Ah, so that's how you include a global variable into the properties menu. Thanks!
  11. N

    Trim/Remove line breaks from every field in every record

    Hi. I'm trying to write a generic function that can take in a table of any size and Trim and remove all carriage returns and line feeds from everything. The thing is while I know how to loop through every record and edit a specific record, I haven't done every field in every record before. Right...
  12. N

    End user input to pull a specific record

    In a form linked to your table, create a textbox called txtFilter. Create a button called cmdFilter. Use the OnClick event of cmdFilter and set it to something like this: If IsNull Me.txtFilter Then Me.FilterOn = False Else Me.Filter = "[CustomerNo] = " & Me.txtFilter Me.FilterOn = True End If...
  13. N

    Question Two divisions but one set of database objects, How?

    Personally, I would create a query for each division. From then on, the data source would be either one of those two queries instead of the actual table. Everything else should be based on data from either of the two queries. I find this a lot easier to deal with than coding in your own filter...
  14. N

    Question Document Control

    It's certainly doable. Not sure how many people in your company will actually use it diligently if they aren't organizing their files already. Also consider access rights. I know at my place, different people have different permissions for what part of our servers can be accessed. So if a person...
  15. N

    DLookup With Multiple Criteria

    DupeDateOfMeeting = DLookup("DateOfMeeting", "tblLog", "[DateOfMeeting] =" & frmLog.DateOfMeeting & " AND [StartTime] =" & frmLog.StartTime) One tip I have when you're working with SQL or SQL-like strings is to save them in a variable such as strSQL. Then include a debug.print for the...
  16. N

    Question Access Database Deployment

    ^Agreed. Just take the .accdb file, attach it to an email or upload to FTP or whatever you want, send it to the person. If they have Access 2007/2010, they will be able to open it. If they don't, they'll want to install an Access 2007 runtime which they can download from here...
  17. N

    double criteria for vba delete record

    Oops, missed a quotation mark. Forms!frmClientSale-Retail!Employee = Nz(DLookup("[Employee]", "[tblRecommendedProducts]", _ "[ClientsDetailsID] = " & [Forms]![frmClientSale]![ClientsDetailsID] & _ " AND [ItemID] = " & [Forms]![frmClientSale]![OrderItemsID]), "")
  18. N

    Warnings problem

    I'm guessing the warning you turned off is probably for the warning messages that pop up when you're about to delete records and stuff (DoCmd.SetWarnings False). There's no VBA or Macros to automatically turn off the trust warnings on startup as no VBA or Macros are run while the application is...
  19. N

    double criteria for vba delete record

    Ah, in that case, you don't even need SQL. Just use a DLookup. Something like: Forms!frmClientSale-Retail!Employee = Nz(DLookup("[Employee]", "[tblRecommendedProducts]", _ [ClientsDetailsID] = " & [Forms]![frmClientSale]![ClientsDetailsID] & _ " AND [ItemID] = " &...
  20. N

    double criteria for vba delete record

    I still can't find the code in your project. Just to make sure I'm understanding you correctly, this is what I think you want to happen: Actions - Set Employee value in tblRecommendedProducts to the value of the ComboBox named Employee in frmClientSale-Retail Conditions - ClientsDetailsID from...
Back
Top Bottom