Search results

  1. G

    Access Lines of a Macro

    Got it! It's a bit of a hack, but it works. I borrowed on some code I found in the code repository http://www.access-programmers.co.uk/forums/showthread.php?t=99179 Private Sub GetMacrosText() 'Put these two lines in the declarations section of the module 'Public iMarcoCount As...
  2. G

    I'm stumped by this code

    txtDate.SetFocus If Len(Trim(txtDate.Text)) > 0 Then ' only if it is populated If Not IsDate(txtDate.Text) Then MsgBox "You did not enter a valid date. Please try again.", vbInformation txtDate.SelStart = 0 txtDateSelLength = len(txtDate.Text) Exit sub...
  3. G

    Access Lines of a Macro

    I'm trying to read a macro in VBA Code. With forms and reports I can iterate all of the controls and objects on the form or report. I can read and set properties of the controls. I use the AllForms() and AllReports() collections to do this. There is the AllMacros() collection but it only returns...
  4. G

    How do I display array contents to user?

    You can also loop through an array like this.... ReDim sMyArray(10) As String Dim sTemp As String Dim k As Integer Randomize For k = 0 To UBound(sMyArray) sMyArray(k) = Trim(Str(CInt(Rnd * k + 1))) Next For k = 0 To UBound(sMyArray)...
  5. G

    I'm stumped by this code

    The test in the text box has a data type of String. The Date key word returns a data type of Date. You need to convert the String in the text box to Date and then do your comparison. You should also make sure that it is a valid date in the text box. txtDate.SetFocus If Not IsDate(txtDate.Text)...
  6. G

    Output to file.

    Try something like this... Dim iFreeFile As Integer Dim sMyFile As String Dim sOutPut As String iFreeFile = FreeFile sMyFile = "c:\mytextfile.txt" sOutPut = "This is one line of text " sOutPut = sOutPut & "This is on the same line" sOutPut = sOutPut & vbCrLf & "This is one a new line" Open...
  7. G

    Queries

    I'm not sure about VB2005 but in VB 6, which is what I program in, I would add a Reference to the MS DAO 3.6 Object Library. Look for a "Refernces" menu option. Once the library is part of the project you have access to all of the database objects that exist in Access. You can create record...
  8. G

    Passing Parameter From Form to Query

    For anyone interested, the solution was to build the query in the query design window with no criteria. Then use that query to build the report. When I call the report from code (DoCmd.OpenReport) I pass the WHERE clause as a parameter to the OpenReport method. It does pretty much what I want to...
  9. G

    Passing Parameter From Form to Query

    Thanks, but no, that's not the problem at all. In fact, it's the exact opposite of my problem. You're building the entire SQL string in code which I could do in my sleep. I'm talking about passing values drawn from multiple controls to query a single field in THE QUERY DESIGN WINDOW. The...
  10. G

    Passing Parameter From Form to Query

    Thanks for the replies. Perhaps I didn't explain the problem I'm having well enough. Accessing a control's value is not an issue. As I said, looping through the check boxes and building the query string is easy. Also, accessing a single controls value from the query window is also easy, as I...
  11. G

    Passing Parameter From Form to Query

    I’m moving from VB to Access for creating front ends. One of the things I would commonly do in VB is build a SQL string based on controls. I would then create a records set. Simple enough. Now in Access I want to pass parameters to a query from a form, run the query, and then produce a report...
Back
Top Bottom