Search results

  1. G

    Search Form & Error Messages

    I did - thanks. Code now reads: Private Sub txtPayrollIDSearch_AfterUpdate() If DCount("*", "tblUser") > 0 Then Dim sWHERE As String sWHERE = "[PayrollID] = " & Me.txtPayrollIDSearch sWHERE = "[PayrollID] LIKE '" & Me.txtPayrollIDSearch & "*'" DoCmd.OpenForm...
  2. G

    Search Form & Error Messages

    I'm not sure that's going to be of any use to me as it returns all 11 users in the table, none of which have the same combination of letters or numbers. For reference, this is what I have in my code now: Private Sub txtPayrollIDSearch_AfterUpdate() If DCount("*", "tblUser") > 0 Then...
  3. G

    Search Form & Error Messages

    It works on the Surname search but just not in the PayrollID search. An example Payroll ID number is JD12345 with an input mask of 'LL00000'. I'm really new to all this so don't know what you meant by the DCount() bit...
  4. G

    Search Form & Error Messages

    SOLVED: Search Form & Error Messages Hi All, I have two unbound text boxes and a search button adjacent each that allows me to search for a user via two methods: 1) Payroll ID 2) Surname They have the following code: txtPayrollIDSearch Private Sub txtPayrollIDSearch_AfterUpdate() Dim...
  5. G

    Enter Key & Search

    Somewhere along the line I had removed 'Else' from the 'If' statement - what a tool. Please delete thread.
  6. G

    Enter Key & Search

    Please delete this thread.
  7. G

    Enter Key & Search

    I've stripped down the code a bit and now it thinks the text box is empty because the message box keeps coming up. I've removed the message box section of the code and it works fine. :confused: Previously it didn't work properly because I had forgot to change "[Surname]" to "[PayrollID]" and...
  8. G

    Enter Key & Search

    Disregard; I thought it might have not been working because the text box had an input mask. Unrelated question: Furthermore, if I search for something that doesn't exist, it opens up the form anyway with a blank record - how can I prevent that?
  9. G

    Enter Key & Search

    Disregard.
  10. G

    Enter Key & Search

    Hi, I've tried after update - it doesn't do anything other than move to the search button. EDIT: Me being an idiot I had fiddled with the code just before this post and had removed the 'Else' bit from the code.
  11. G

    Enter Key & Search

    Hi All, I have a simple search form that has a two text boxes and two search buttons. One of the search buttons and text boxes is as below: txtPayrollIDSearch and cmdPayrollIDSearch I have the following code for the search button: Private Sub cmdPayrollIDSearch_Click() If...
  12. G

    Make Code Available to All Forms (Remove Duplication of code)

    Thanks. I've deleted the other forms - I think I'll go another route with them. What I had was a developer form and a normal user form. The dev form allowed me to assign an access level ID, whereas the user one was defaulted to a certain level and hidden. I will need to trap who is logged in...
  13. G

    Make Code Available to All Forms (Remove Duplication of code)

    Thanks to all. I've used Way2bord's code and have tagged the module to the 'After Update' event on a certain combo box on each form which has worked for me.
  14. G

    Make Code Available to All Forms (Remove Duplication of code)

    Pardon my ignorance but I cannot see an "on change" property in the forms properties. To clarify is it a class module or regular module that I create? EDIT: Tried both and for anyone else like me, it's a regular module. Thanks for the link pbaldy, I've now named, the module something...
  15. G

    Make Code Available to All Forms (Remove Duplication of code)

    Hi there, Do you have any suggestions (I'm new to database design and VBA)? Do I just swap out, 'Public Sub' with 'Public Function' - but then where do I put the code and how do I link it to the forms? For instance I have these forms: frmDevAddUser frmEditUser fmrAddUser
  16. G

    Make Code Available to All Forms (Remove Duplication of code)

    Hi All, I have several forms which are basically a copy of one another, the only difference is is that each one has a combo box or two missing, and or a variation of buttons. I also have some simple vba code I want each of these forms to use. At the moment I have the code on each form, but if I...
  17. G

    Available List Based on Previous Field's Selection

    I've now got some code that when the form is opened, disables the combo box - cboManagerID - if cboLocationID is null. I've also got some further code on cboLocationID so that when a value is selected, cboManagerID becomes available. This obviously prevents anyone from selecting the second...
  18. G

    Available List Based on Previous Field's Selection

    No worries - I also changed the double quotes where it joins the forename and surname together to single quotes. I still cannot get this to sort into order though, no matter what I do.
  19. G

    Available List Based on Previous Field's Selection

    I think I'm getting there (I've learnt a bit this evening, I'm not going to sleep until it's working)... I'm fairly certain that I need to convert this section: sManagerSource = "SELECT [tblManager].[ManagerID], [tblManager].[Forename], [tblManager].[Surname]" & _ To the SQL equivalent...
  20. G

    Available List Based on Previous Field's Selection

    That code doesn't work, keeps highlighting [tblManager] in the line (and also highlights in red): "[tblManager].[Surname] & ', ' & " [tblManager].[Forename] " & _ Unexpected: end of statement I've fiddled around some more and mixed 'n' matched (I've not got a clue what I'm doing as you can...
Back
Top Bottom