Search results

  1. J

    HELP! Trying to make a query where every 5 orders a customer receives a discount.

    No problem Joe You could also use DCount directly on the ordertable, and since DCount dosen't error on missing customer you don't need the Nz() wrapper function. It is a lot cleaner I think. =IIf(DCount("*","tblOrder","CustFK=cboCustomer") Mod 5=0,[cboProduct].[Column(2)*0,5*[NumberUnits],0)...
  2. J

    How do i allow users to select a item for a listbox and then display related records

    See attached DB for an example of cascading list/combobox JR
  3. J

    HELP! Trying to make a query where every 5 orders a customer receives a discount.

    See attached mdb. Its an over simplyfied db just to show the mechanics of the expressions. I'v added a Current count on the form so you can see when a customer gets his count to his fifth count and watch how the locked discount control displays the discount. There is little VBA in the form...
  4. J

    Insert computer name

    Paste this function in a Standard module of your project Function GetComputer() GetComputer = VBA.Environ("Computername") End Function Then in the controlsource of an unbound control on yor form you put in this: =GetComputer() JR
  5. J

    HELP! Trying to make a query where every 5 orders a customer receives a discount.

    You can use Dcount() function to count record on your ordertable and if the result of the count in Mod 5 = 0 then you give a discount. Here is a test done in a function to only display every 5th number: Function CountOrders() Dim x As Integer For x = 1 To 50 If x Mod 5 = 0 Then...
  6. J

    How do i allow users to select a item for a listbox and then display related records

    Sounds like you shuld be searching for the concept of Cascading combobox Like this one: http://baldyweb.com/CascadingCombo.htm JR
  7. J

    Back with a more challenging query

    See this tread perhaps: http://www.access-programmers.co.uk/forums/showthread.php?t=217993 JR
  8. J

    Can't find a way to trap error!

    One other thing is that using If MacroError <> 0 could be dangerous because ALL errors will be reset, it would be wise to only trapp a specific and anticipated errors. In this case you would trap errornumber 2105 so i would use If [MacroError] = 2105 Then ClearMacroError Else...
  9. J

    Problem with VBA and Access 2010

    btw here is a list over Word Constants :http://msdn.microsoft.com/en-us/library/aa211923(v=office.11).aspx JR
  10. J

    Problem with VBA and Access 2010

    It did not work because you probably still has Microsoft Word refrenced in your refrences. What VbaINet is suggesting is to use LateBinding of word so that different Word versions dosen't clash, remove the refrence to Word and try again. However using latebinding you must supply constants to...
  11. J

    Can't find a way to trap error!

    If your goal is to NOT get the standard msgbox then clear the macro errorobject. In your macro after this statement. If [MacroError] <> 0 Then choose action: ClearMacroError This will reset the errorobject to 0 and nothing will happen when when you are on the first record and try to...
  12. J

    Update Query

    No problem, use the site VbaInet gave you to understand string manipulation functions they are useful. Happy coding JR
  13. J

    Update Query

    You use instr()+1 to locate the startposition of the next character in the string after @. The Mid(string,start,stop) function takes the the result of instr() in the 2. parameter and since you don't give a stop parameter it will give you the rest of the string. Putting it all together...
  14. J

    Split DB slow in development mode

    Do you have a persistent connection to your backend? http://www.granite.ab.ca/access/performanceldblocking.htm To speed up loadingtime for forms here are some tips (same site): http://www.granite.ab.ca/access/performanceforms.htm JR
  15. J

    SQL Where and Between

    Remove the second WHERE, marked in red. DoCmd.RunSQL "UPDATE MuhurDB SET location = " & Me.Location & " WHERE Grup =" & Chr(39) & grup & Chr(39) & " AND WHERE muhur BETWEEN " & fromTxt & " AND " & tillTxt JR
  16. J

    Question Access 2007. Export query result to Excel and create SUM per column

    In you current rutine you can't. If your not code savy the esiest way is to open the excel document after your output command and put in the formula manually. Private Sub Excelexport_Click() DoCmd.OutputTo acQuery, "AmountReportQuery", "MicrosoftExcel(*.xls)"...
  17. J

    Conditional Query

    How about using an Immediate IF - IIF() statement Create a calculated field MyDate: IIF([ReforecastDate] > [BaselineDate], [ReforecastDate], [BaselineDate]) JR
  18. J

    Force Focus back to Control

    No problem JR
  19. J

    Force Focus back to Control

    Use the control's BeforeUpdate so you can use Cancel argument to have the focus remain in the control. Private Sub txtADD_Invoice_BeforeUpdate(Cancel As Integer) Dim strDupInvoice As Variant strDupInvoice = Nz(DLookup("[INVOICE NUMBER]", "dbo_Tbl_AP", "[INVOICE NUMBER] = " &...
  20. J

    insert into a table from a msgbox input

    You need to refrence your variable outside the Sql-string Private Sub Command45_Click() Dim SetPrice As Currency SetPrice = InputBox(Prompt:="Enter New Price Base.", _ Title:="New Price Base", Default:="Enter here") DoCmd.RunSQL "INSERT INTO...
Back
Top Bottom