Search results

  1. Z

    Open form on combobox after update event and set combobox selection on opened form

    Sorry if I caused an issue here, this was certainly not my intention. @Pat Hartman you are right. My knowledge about VBA is very limited and I grab a little bit from here and there to put my database together. In this case maybe I should have been more specific. The combo-box on the opened form...
  2. Z

    Open form on combobox after update event and set combobox selection on opened form

    Hi I have a (frm_Main) with one combo box "cbm_Main". In the combo box after update event I would like to open (frm_List) which also have a combo box "cbm_List" Both combo boxes has the same control source "qry_Departments" and the bound column is 1. The content are numeric values. I would like...
  3. Z

    A little help with If, Else and Exit sub

    No - it opens the form showing the records matching the employee ID where off is equal to 0. Off=0 is set when Stop time field (Which is a date field) is empty
  4. Z

    A little help with If, Else and Exit sub

    Hi This works Thanks... :-) However, the form opens even though both criteria aren't met. So I ended up with this: Private Sub btn_StopOrdre_Click() Dim intanswer As Integer If cbm_Medarbejder = "" Then intanswer = MsgBox("Husk at vælge medarbejder fra dropdown listen", 64, "Vælg...
  5. Z

    A little help with If, Else and Exit sub

    If "cbm_Medarbejder" empty then msgbox If cbm_Medarbejder = "" Then intanswer = MsgBox("Husk... Vælg medarbejder fra dropdown listen", vbOKOnly) Forms!frm_ctn_list!cbm_Medarbejder.SetFocus Exit Sub Else so far so good :) Instead of checking a query's outcome it might be better...
  6. Z

    A little help with If, Else and Exit sub

    Well "cbm_Medarbejder" is on the current form but the "Off" field is located in table "tbl_TidsTabel" Am I missing a table reference here ?
  7. Z

    A little help with If, Else and Exit sub

    Hi Thanks for the quick reply :) I must be doing something wrong. It looks like the first criteria is ignored as it goes to the DoCmd.OpenForm... where I get an error cause "cbm_Medarbejder" isn't filled out yet - this makes sense. However maybe I have a syntax error i my opening criteria for...
  8. Z

    A little help with If, Else and Exit sub

    I have a form where a production order can be stopped by the button "btn_StopOrdre". However certain conditions must bet met in order to do this. First criteria - If no choice has been made in combo box "cbm_Medarbejder" a message box tells the operator to fill it out. Second criteria - If the...
  9. Z

    If statement with two criteria

    Thanks.. Maybe my logic is off. I cant seem to make it work First I make sure that the user has made a choice in the combobox with this. Dim intanswer As Integer If IsNull(Forms!frm_ctn_List!cbm_Medarbejder) Then intanswer = MsgBox("Husk... Vælg medarbejder fra dropdown list"...
  10. Z

    If statement with two criteria

    I am not sure how to add the last criteria. I get an error on this one If DLookup("[MedarbejderID]", "tbl_TidsTabel", "MedarbejderID = " & cbm_Medarbejder.Value & "") And [On] = 0 Then
  11. Z

    If statement with two criteria

    Hi I have a button on form "frm_ctn_List" called btn_StopOrdre. In the "on click" event of this I would like to show a msgbox if field [MedarbejderID] in table "tbl_TidsTabel" equals combobox "cbm_Medarbejder" value. and field [On] in table "tbl_TidsTabel" equals 0 Otherwise open form...
  12. Z

    Combobox value for multiple filter criteria in a Query

    Actually there are values from 0 to 4 which represents different status of productions orders. I only need to work with status 3, correct, but I was just trying to change something to see if I could get it working :)
  13. Z

    Combobox value for multiple filter criteria in a Query

    Tried to make Location Code and Production Order status cbm selections, but I get a missing operator error. When the actual code of an cbm selection after update event is placed in another cbm after update like this is. Could that work, or should each "If" statement be placed in the after update...
  14. Z

    Combobox value for multiple filter criteria in a Query

    It kind of semi works now :) I still have the record source set to the original query but removed the criteria set there for the above fields. Otherwise I still get no destination fields. However the DepartmentSelection filter does work for for some of the selections which is kind of strange...
  15. Z

    Combobox value for multiple filter criteria in a Query

    Hi again I get a data type mismatch error. tbl_Status.Status_Status is a number dbo_KonfAir DRIFT$Production Order].Status is a number dbo_KonfAir DRIFT$Production Order].[Location Code] is a short text field dbo_KonfAir DRIFT$Item].[Item Category Code] is a short text field strSQL = strSQL &...
  16. Z

    Combobox value for multiple filter criteria in a Query

    Hmmm... Still not there yet If the record source is set to the initial Query and I open the form, it open up correctly. But when I change combo box value I get the attached error. If I set the record source to strSQL I get "Query must have at least one destination field" I have another combo...
  17. Z

    Combobox value for multiple filter criteria in a Query

    When I do that I get the error attached referring to setting the recordsource to strSQL Me.RecordSource = strSQL I can open the form. The error occurs when updating the combo box
  18. Z

    Combobox value for multiple filter criteria in a Query

    Do I need to put the tables and fields inside the Query builder for the form to find the record source ? Yes... it was first created in a query and initially used as record source. Now, if I change it to strSQL then I get the error "Query must have at least one destination field"
  19. Z

    Combobox value for multiple filter criteria in a Query

    Thanks :) Isn't the record source suppose to be set to strSQL, like the attached image. I get an error that the record source doesn't exists
Top Bottom