Recent content by Silver_surfer

  1. S

    Select bound Combobox value using VBA based on variable?

    Okay, this is so obvious I want to kick myself The combobox is expect 2 column, where I only select 1 🤦‍♂️ So it becomes Private Sub Form_Load() Dim lngID As Long lngID = DLookup("EmployeeID", "Employees", "[Nama]= '" & strUser & "'") Me.Assigned_To.RowSource = "SELECT...
  2. S

    Select bound Combobox value using VBA based on variable?

    It's in the Form Load event Private Sub Form_Load() Dim lngID As Long lngID = DLookup("EmployeeID", "Employees", "[Nama]= '" & strUser & "'") Me.Assigned_To.RowSource = "SELECT Nama FROM Employees WHERE EmployeeID= " & lngID Me.Assigned_To.Locked = True End Sub
  3. S

    Select bound Combobox value using VBA based on variable?

    Okay, I have reopen the accdb file No error, but still the combobox is blank with no list values Any help?
  4. S

    Select bound Combobox value using VBA based on variable?

    @Minty That's another way that I haven't think of, thankyou ;) But same with @arnelgp code, this line lngID = Dlookup("EmployeeID","Employee", "[Nama]= '" & strUser & "'") gave me error "Invalid use of Null" Where's the problem?
  5. S

    Select bound Combobox value using VBA based on variable?

    @CJ_London in my understanding, the bound column (EmployeeID) in the combobox is an autonumber and saved to table as number too, so I need to provide the EmpoyeeID instead of just Nama, is my understanding correct?? Thats why the need for DLookup, because strUser value is the username (John Doe)...
  6. S

    Select bound Combobox value using VBA based on variable?

    So I have a bound combobox, lets call this Assigned_to It has 2 Column, EmployeeID and Nama, with first column as bound column, and hidden What I want is, to autofill this combobox with Nama, which defined in strUser and then lock it when user open the form I have tried to use .RowSource...
  7. S

    Solved DMax increment numbering not working

    When PO is expected for December, then it only can be ordered by Customer in January So the rules required the PO number to start from 1 when Expected Date past 30 November As I said, it's my workplace reason, not Access Sorry if my wording is confusing I tried to write a bunch of dummy record...
  8. S

    Solved DMax increment numbering not working

    Well, I need to give my "Purchase Order" a sequential numbering, so I guess can't use DCount And it needs to restart at each December for technical reasons (workplace reasons, not Access) I see, was confused with the '<' before My bad, English isn't my first language So the code would be If...
  9. S

    Solved DMax increment numbering not working

    Well, I've tried to change 30/11 to 11/30, and still not working Actually that's what I want So for every record where [Expected Date] is before 1 December this year, I want the number to keep increment At 1 December, the number restart at 1, and then keep increment until 30 Nov next year I...
  10. S

    Solved DMax increment numbering not working

    Actually I've correcting it The increment work right now, but I can't make it restart at 1st December It just stuck at highest number and keep repeating it Any help?
  11. S

    Solved DMax increment numbering not working

    Do you mean the [Expected Date]? It was formatted to Short Date, and the default is dd/mm/yyyy, per my region Where do you think the problem is?
  12. S

    Solved DMax increment numbering not working

    Sorry my bad 🤦‍♂️ I've just aware of the logic in my code about same time as your post , fool me Thanks for pointing out So I've changed the code to Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.NewRecord Then Me.[NoP3C] = Nz(DMax("[NoP3C]", "Purchase Orders", "[Expected Date]<...
  13. S

    Solved DMax increment numbering not working

    Okay, so I've tried to trap the null value using Nz Now I get the number, but its not increment 🤦‍♂️ So the first record got number 1, and so is the second, third... Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.NewRecord Then Me.[NoP3C] = Nz(DMax("[NoP3C]", "Purchase Orders"...
  14. S

    Solved DMax increment numbering not working

    Hi guys, I'm new to Access, and is now in the process of editing Northwind templates to suit up my needs However, right now I'm stuck at making my own version of increment number Nothing too fancy actually, I just need the number to restart at the start of December Private Sub...
Back
Top Bottom