Search results

  1. B

    Text file Import: only 25 rows available

    There are several pieces of data that need to be extracted from the text file. I like the idea of reading the entire file into a table, then manipulating the data. Thanks to all of you that took the time to respond. Much appreciated!
  2. B

    Text file Import: only 25 rows available

    We are trying to import a text file. We are having two problems. First a little history about the text file: The text file contains results of a lab test. The data of interest does not appear before row 50 of the text file. The text import wizard in access does not show any rows after row 25...
  3. B

    use variable as reference in vba select statement

    No Single quotes - Doesn't work Here is the code as edited to remove single quotes: Set rst = dbs.OpenRecordset("Select " & strTest & " from Custody where LABID = '" & Me.txtLabID & "' AND " & strTest & " = '" & Me.txtMethod & "';") If I knew how to make the value appear in a MsgBox, I...
  4. B

    use variable as reference in vba select statement

    Hi PB, Here is the line of code after editing. Set rst = dbs.OpenRecordset("Select '" & strTest & "' from Custody where LABID = '" & Me.txtLabID & "' AND '" & strTest & "' = '" & Me.txtMethod & "';")
  5. B

    use variable as reference in vba select statement

    If I take the existing select line and put it in a MsgBox, the only part that is evaluated showing quotes are the form references. Just for kicks, I edited the line so that the variable was treated the same way as the from references - didn't help. The form references show the values in the form...
  6. B

    use variable as reference in vba select statement

    I am trying to use the variable strTest as a variable in the select statement below. The fields in the custody database contain F8 thru F34. Private Sub txtMethod_BeforeUpdate(Cancel As Integer) strA = 8 Do While strA < 35 strTest = "F" + strA Set dbs = CurrentDb Set rst =...
  7. B

    Pass a variable from form code to vba macro code.

    How can one pass a variable form form code to macro code. StrA is a variable with the value of 8 used in the vba code of a form - frmCustody We have a macro called Test how can macro test run the line: MsgBox strA and have the value 8 appear in the message box. Thanks, B
  8. B

    Changing form values from a macro

    Many Thanks Thanks Bob. Once again, you are right on the money!
  9. B

    Changing form values from a macro

    I have written the following macro that is in module 1. Sub Test() DoCmd.SelectObject acForm, "frmCustody" frmCustody.Me.Controls("F9").Value = "Ag" End Sub I get the following error: Object required. Any ideas how to get the value to show up in the form when the macro runs?? Thanks, B
  10. B

    Punctuation Aggravation

    Simplest Solution Set rst = dbs.OpenRecordset("SELECT LocationName FROM PWS WHERE LocationNumber='" & Me.LocationNumber & "' AND PWSName='" & Me.PWSName & "';") Thanks to all for your help. The code above works, and is easiest for me to grasp. Thanks again to all!!
  11. B

    Punctuation Aggravation

    Punctuation Problems Location number is actually a text field - there are some characters in a few of the location numbers. If you look at the first line of code - it works. In the second line I am trying to select based on two criteria: the location number AND the location name - both text...
  12. B

    Punctuation Aggravation

    It took forever to get the following line to work in VBA: Set rst = dbs.OpenRecordset("Select [LocationName] from PWS where [LocationNumber] = '" & Me.LocationNumber & "';") Now I am trying to get the following line of code to run with no success: Set rst = dbs.OpenRecordset("Select...
  13. B

    Concatenation of field name

    Concatenation Thank you Hi Bob, Thanks for the reply. I can't wait to get home and give it a shot. I have a feeling that the snippet you sent will do the job. Thanks again. BB
  14. B

    Concatenation of field name

    Concat cont'd We are an environmental testing lab. We enter samples into a table called Custody using a form - frmCustody. The form has more than 20 text boxes. Each text box is from a field in the Custody table. The form has text boxes F8 thru F28. When using the form we enter lab tests...
  15. B

    Concatenation of field name

    Correction to previous reply Private Sub cmdContinue_Click() strA = "8" Do While "Me.F" & strA <> "" MsgBox "Me.F" & strA strA= strA +1 End The MsgBox displays Me.F8 not A thanks
  16. B

    Concatenation of field name

    VBA concatenation Problem This is an event for a command button in a form. As in original message - no problem making the "word" F8. The problem is displaying the contents of the text box in the form. Private Sub cmdContinue_Click() 'strA = "8" Do While "Me.F" & strA <> "" MsgBox strA strA=...
  17. B

    Concatenation of field name

    I am trying to get a message box to show the contents in several fields in a Do loop by concatenating the letter "F" + a counter. The following are values in fields in the form I am working with Field Name Value in Field F8 A F9 B F10 C What is the...
  18. B

    Cursor placement

    Hello All, If the user enters an invalid client name in the client field of a form, I have a msgbox pop up that says invalid client name. No problem. I want to make the cursor go back to the client filed in the form to correct the entry. What is the vba code that will allow me to place the...
  19. B

    Data type mismatch

    The following line of code works: Set rst = dbs.OpenRecordset("select [PWSNAME] from Client where [ClientNum] = '9190';") The following line of code gives the error described after the code below: Set rst = dbs.OpenRecordset("select [PWSNAME] from Client where [ClientNum] = " & Me.ClientNum &...
  20. B

    Executing select statement in vba

    We have created a form from our custody table called frmCustody. The form has a text box called - txtClntNum and a field called client. I have the following statement: Option Compare Database Dim strLabID As Long, strClient As String Private Sub txtClntNum_AfterUpdate() strClient =...
Back
Top Bottom