Recent content by Mr_Si

  1. M

    end select without select case error

    Ah, yes that's what I'd found whilst searching some more. Thank you. Btw, what does option explicit actually do?
  2. M

    end select without select case error

    Don't worry, I've fixed it - I'd missed an end if statement.
  3. M

    end select without select case error

    Hi all, I'm getting a strange ocurrence of the error in the title when I add a couple of lopps within a select case statement. The full code is below (including the (currently commented out) for each next code that throws the private sub in to an error). Private Sub btnSaveClose_Click()...
  4. M

    VBA Insert into combo box and requery issue

    I had a brainwave on Friday on my cycle home. My code now works! Private Sub btnSaveClose_Click() Dim strINSERT As String Dim numBatch As Long 'pre-cleanup strINSERT = "" numBatch = 0 Select Case OpenArgs Case Is = 5...
  5. M

    VBA Insert into combo box and requery issue

    Because it's a lookup from another table, it's made itself in to a combo box and I accepted it that way. But also, there are times when I need to enter stuff directly into the sub form and will need to choose which batch I'm using out of those which have been added in to the database. So, I'd...
  6. M

    VBA Insert into combo box and requery issue

    Yes sure. Here is the order of events: When checking in tblComponentBatch, however, the data is all there to be pulled from:
  7. M

    VBA Insert into combo box and requery issue

    Ok, I think I'm getting there but I'm getting a data conversion error. I want to reference column2 of the combo box in the recordset but I can't find the syntax for want of trying... My code now looks like this: Private Sub btnSaveClose_Click() Dim strINSERT As String Dim strSQL As...
  8. M

    VBA Insert into combo box and requery issue

    Yep, still not working so trying something else now. Here's the modified code for the Click event of the close button: Private Sub btnSaveClose_Click() Dim strINSERT As String Select Case OpenArgs Case Is = 5 If Me.Dirty Then Me.Dirty =...
  9. M

    VBA Insert into combo box and requery issue

    Thanks, yes I saw that somewhere else, so will give it a go before trying something completely different.
  10. M

    VBA Insert into combo box and requery issue

    So now, I think maybe I need to get the sub form to pull the batch number from the table in a different way rather than trying to update that particular control by using an insert into query. Everything else will work as an insert into, but not the batch combo. would that make sense do you think?
  11. M

    VBA Insert into combo box and requery issue

    Ok, I've got a little further - I've managed to get the new batch number to be available in the combo box now, by forcing a record save to tblComponentBatch when first clicking on the Close button. The magic bit of save code I used to force a write to the table whilst keeping the form still...
  12. M

    VBA Insert into combo box and requery issue

    Yeah, I think it has to be something to do with that. I'm looking in to that now. Thank you. Edit: I think what I was thinking originally is that if I'm inputting the data in to frmComponentBatch, when I'm typing it in, then when I requery the batch combo box in the subform of the other form...
  13. M

    VBA Insert into combo box and requery issue

    Thank you for your reply @The_Doc_Man, I have tried putting it in different places, including right after the insertinto code but to no avail. Investigating further I think it must be something to do with the rowsource and control source, all the other combo boxes. The subform's recordsource...
  14. M

    VBA Insert into combo box and requery issue

    I was just typing a reply saying I've actually just had a thought about this! The recordsource is tblComponentHistory, but the rowsource is qryComponentBatch, which doesn't reference that particular table. I think I'm going to have to look at this tomorrow!
  15. M

    VBA Insert into combo box and requery issue

    You have the correct combobox name in your code, yes, it's "Batch" (probably should be cboBatch, but I was being lazy). Trying that slight change as I type... Nope it's not updating the combo box still. Thank you for correcting the syntax though.
Top Bottom