Search results

  1. N

    Help needed with Split()

    Yes, I know your error is run-time, but I thought the syntax of your split funtion would cause a compile-time error because intNr sat outside of the split. Chris spotted the intended use which I had missed and he's given you the code you need, so hopefully problem solved! :-)
  2. N

    Help needed with Split()

    Where does the error occur? It looks like your TestSplit function may be the culprit. Split returns an array of strings which represent the text between delimiters ("+" in your case). You need to define a string array of zero length (Dim strSplit () As String) and then use this forthe output of...
  3. N

    Question Normalising my data

    Firstly, I suggest you identify your tables with meaningful names – this will help determine what they should contain and will make future support easier. Secondly, I think there may be need for a fourth table here, as I’ll show below. Picking up from your 2NF group: It appears that TABLE 1 is...
  4. N

    Question Importing reports or form query

    The 'suporting logic' I referred to is the mechanism to gather the pieces together in whatever way you need. You might use an intermediate DB at each location which could be used for exchanging changed forms and reports, so the DoCmd.TransferDatabase would import locally and the results shipped...
  5. N

    Make Form Appear Automatically After Opening Database

    You can set the form which opens with your database in the Application Options. These are in the Current Database tab of Access Options, which you will find from the Office buttom (top left of Access window).
  6. N

    Database design help!

    This sounds like a complex project for a novice Access user. Have you considered pre-packaged software which does what you describe using web interfaces? You would have a much shorter implementation time, plus you would get the support of the product vendor. If you search the internet for...
  7. N

    How can I disable a Print Command button?

    What is the failure you are getting? If I read your description correctly, then Passed is a command button? Command buttons don't have a value property, which may be the reason for the failure you have. The thing I notice about your code block is the 'Else:' which seems wrong in context. Try...
  8. N

    button on a continious form (visible/not visiable )question

    The button is related to the form and not its underlying recordset, which is why it's always visible or always invisible. What you are describing is an attribute of each record, so you would need a field in the record itself showing the settled state. If you put a click event on that field, you...
  9. N

    Question Importing reports or form query

    Have a look at the DoCmd.TransferDatabase method. This should do what you need with some supporting logic. You may also need the DoCmd.Rename and/or DoCmd.DeleteObject methods in the target DBs to rename or remove the existing object before importing the new version.
  10. N

    Access table data

    When you use RecordCount, it gives the number of records encountered so far. You have to use MoveLast in order to get the RecordCount set to the highest record number in the recordset (this is not recommended for large recordsets, as it can affect performance). Having positioned the recordset at...
  11. N

    Access table data

    Your first example is nearly right – you just need to add MyData.MoveNext just in front of the Loop statement. In your second example, you would have to do MyData.MoveLast then MyData.RecordCount to get the number of records before MyData.MoveFirst to return to the start of the recordset. This...
  12. N

    Noob needs help

    Are the data in SubformA and SubformB connected in any way? Are these data connected to the main form? Assuming “no” to both these questions, then you have no intrinsic link between the records. You may be able to use the Form_Current event of each subform to determine which one is selected...
  13. N

    Close Excel after OutpuTo function

    I'm confused by your context. The code snippit creates an XLSX file and starts Excel to open the target file, so why do you want to close Excel at that point? In Excel, ActiveWorkbook.Close depends on your newly created workbook being the active book whilst the macro code is running. Where is...
  14. N

    Question Normalising my data

    Your data appear to have three main elements: 1-Product; 2-Customer; 3-Order. So start with three tables named Product; Customer; Order. Each Order record will have exactly one customer record attached to it, but will have one-to-many Product records attached. Each of the tables will have its...
  15. N

    cross table subtraction with a “where” clause

    Here's a rudimentary VBA routine which may give you some clues: Private Sub updateStock() Dim rstCurrentSale As Recordset, rstDraughtStock As Recordset Set rstDraughtStock = CurrentDb.OpenRecordset("SELECT * FROM tblDraughtStock;") Do Until rstDraughtStock.EOF Set rstCurrentSale =...
  16. N

    Forms Displayed Side-by-Side

    You can adapt the following code as you need, but this gives the principles of what you want to do. Copy the following into a module: Rem put this code in a module so it can be used by any form Public Sub alignForms(pFormLeft As String, pFormRight As String) Rem check that 'left' form is loaded...
  17. N

    Display result of the query in listbox

    As your tables have the same structure, you could use the SQL UNION to combine the results in a single query. See www w3schools.com/sql/sql_union.asp.
  18. N

    Returning Value from SQL statement into VB string

    I think this may be an order of execution problem? You need to set up the text in Strstaff first, then the query string in StrSql before doing the Set Rcd=CurrentDB.Openrecordset(StrSql). I suspect you are picking up the first record in the record set if the code is in the same sequence as your...
  19. N

    Returning Value from SQL statement into VB string

    You are assigning the literal "SELECT staffname FROM staff where staff.staffkey=" etc to StrSql without executing the query. If you Set Rcs = CurrentDb.OpenRecordset(StrSql) and then use .Body = mymsg & Rcs!staffname it should do what you want.
  20. N

    Access 2010 form defaults

    In Access Options, go to the Object Designers tab, then find Forms/Reports. There you can set up your default template (a form of your own design) for use on new forms.
Back
Top Bottom