Search results

  1. S

    Exporting listbox values to Excel - can I use Docmd.TransferSpreadsheet?

    Found an easier solution Private Sub Exprt2Excel_btn_Click() Dim i As Integer Dim n As Integer Dim strLine As String Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("Export_location\Export.csv", True) For i = 0 To...
  2. S

    Exporting listbox values to Excel - can I use Docmd.TransferSpreadsheet?

    Hi all, As the question states, Im trying to export the value of a listbox (which is populated from an sql statement). My current code is DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, what goes here??, "c:\File location\Export.xlsx" As Im not exporting from a table but a...
  3. S

    Multiple rows within a subform - how do I do data validation?

    Thanks, I thought it would need a loop as the dlookup would return a value for a column but would stop at just that. Im trying to determin if the other rows in the column are empty or not - as per the code above, vbaInet has done it again thanks :)
  4. S

    Multiple rows within a subform - how do I do data validation?

    If you can picture it the subform within the main form, a user makes thier selection from the mainform and it gets submitted to the subform/holding table. When in holding a user could edit the entries if necessary, and there is nothing stopping them selecting the "blank" next available record in...
  5. S

    Multiple rows within a subform - how do I do data validation?

    Because its only appended to a temporary table, which holds all the records until the user is happy and submits the whole lot to the main table. Why am I doing it this way you ask?? Because if I have the main table within the form and multiple users are submitting to the database they will...
  6. S

    Multiple rows within a subform - how do I do data validation?

    Hi there peeps! Can anyone help me - I think I need to use a loop method but am not sure how to write it. I am trying to check if a sub form field is populated which works fine with an if "" statement. The only problem is that the particular sub form in question would have multiple entries and...
  7. S

    Control displays correct content but string doesnt

    Fixed - one of my strings had a typo and was returning null.
  8. S

    Control displays correct content but string doesnt

    Another (simple one for you but I cant see why) my code isnt entering into the subform within the main form. Here's what I did - I took a copy of the main table and then renamed it "-temp". I then dragged that table into the main form in which then a subform is created. Now I thought my VBA...
  9. S

    Control displays correct content but string doesnt

    Hi, I think this is a daft question butr I cant see why Im not getting the correct result. Here is my code Dim sPONum As Integer sPONum = Me.PONumb_TxtBox If I put a break point at the button and hover my mouse over Me.PONumb_TxtBox it returns the correct value, but if I hover my mouse...
  10. S

    Adding form values into a list box

    As per this example I am trying to get value 1, 2 and 3 into the list box using a button. Once submitted to the listbox potentially I would then add more values into value 1, 2 and 3. http://imageshack.us/f/207/38906208.jpg/
  11. S

    Adding form values into a list box

    Thanks for your time with this.. Ok so I have my form which consists of combo and text boxes, the user makes thier selection from the form and then (this is where I am stuck) clicks a button which adds the forms combo boxes and text boxes values (control values??) to the list box.
  12. S

    Adding form values into a list box

    Hi all, I was wondering if someone could help me? Im trying to collate values from within a form and add them to a list box. Would I use sql and would I declare all of the form controls and then use a mysql insert command or is there a better way? The reason I am inserting them into a list...
  13. S

    Subform lost focus code doesnt prompt user

    Sorry to open this one again... Im trying to set focus on the subform control if the control is blank. As I understand it from reading various posts you have to add 2 entries - 1 to take you to the subform and then the second to take you to the control as per - If...
  14. S

    Subform lost focus code doesnt prompt user

    Thanks guys, if I understand vbaInet correctly - they are right in thinking I need it during control level validation. If its based on the main form the user wouldnt be prompted correctly as they wouldnt have got to the subform data entry at that point. Apologies for my mis-understanding, when...
  15. S

    Subform lost focus code doesnt prompt user

    Fair point, but I have got it to work.... Private Sub Cost_Code_LostFocus() If Nz(Forms![MainForm]![SubForm].Form![Cost Code].Value, "") = "" Then MsgBox "Please enter a cost code" End If End Sub Seems to work - thanks for all the effort with this one :)
  16. S

    Subform lost focus code doesnt prompt user

    I dont think its the code thats the problem, as if I select a value and then delete it I get the message box. It just doesnt seem to trigger the code when going through the routine of data entry
  17. S

    Subform lost focus code doesnt prompt user

    Im sure it is returning a null string as, if I leave the field blank and then query the immediate window it returns Null. And yes I tried the Len() variant and that produces the same result :(
  18. S

    Subform lost focus code doesnt prompt user

    Must have edited before you responded as I forgot to put code in
  19. S

    Subform lost focus code doesnt prompt user

    Its working now, but only if I select\enter a value in the field then delete it and then either tab or enter away from that field. And it only happens once so I can then carry on without having that field populated. Code is Private Sub Cost_Code_BeforeUpdate(Cancel As Integer) If...
  20. S

    Subform lost focus code doesnt prompt user

    Thanks I have corrected my code, but its still letting me bypass the before update validation. Is there anything else that would cause this to ignore the rule? As I said, I definitely am referencing the correct field as the Immediate window is telling me so if I question it.
Back
Top Bottom