Search results

  1. P

    Proper Case function

    Put a string like ChangeProppercase in the tag of the controls you wish to change and use code to loop the controls like this. Set ctl = Me.Controls For Each F In ctl If F.Tag = "ChangeProppercase" Then Me(F.Name) = StrConv(Me(F.Name), vbProperCase)...
  2. P

    VBA Email Coding Issue

    Your firstline of the body is a bit messy, please use code tags the next time you post some code. It wil enhance the readability as the identing as wel as leading and trailing spaces are kept between the code tags. I prefer the use of vbNewline at the end of a line, to me it's easier to read the...
  3. P

    Conditional Formatting a date

    As dates are stored as a number where the part before the comma is the number of days since 1/1/1900 an the time part is after the comma (1 = 24h). Test if the date part is the same like: If split(cdbl(YourFieldnameHere),",")(0) = cdbl(date()) then ...
  4. P

    Run-time error 2220

    You stop the error by testing if the file exists like: Dim PictureFile as string Picturefile = "\\C:\images\jpgs\" & Me.cboPRODUCT_CODE.Column(0) & ".jpg" if len(dir(picturefile)) > 1 then Me.imgIMAGE.Picture = picturefile Else Me.imgIMAGE.Picture = "" End if
  5. P

    msgbox code problems

    Because you don't use the result of your messagebox your code is not working as you expect it to work. Put the result of the messagebox in a variable or use it like: Private Sub Command55_Click() if MsgBox("Do you want to save the changes?", vbYesNoCancel, "Confirm Save") = vbNo then...
  6. P

    looping

    Which line is higlighted in the debugger (you do not show the whole code)? How did you declare your recordset, the type 13 mismatch is to my knowledge a result of mixing ADO and DAO. You need to declare your recordset explicit like: Dim RS as DAO.Recordset '(or ADODB.Recordset)
  7. P

    Stumped: Query asking for info twice?

    Because you close the form that contains the criterea you wil get the message for the missing filter. Simply comment out the "DoCmd.Close acForm, WellFilter" line and you're back to the original behaviour.
  8. P

    Check for folder based on field name

    The function dir has as a result the first folder or file name, the next time calling dir the next file or folder is returned. The way you are checking for the folder existance does not work for this reason, try: If dir("N:\4. Maintenance\Tooling Information\" & me.CHHToolNumber, vbDirectory)...
  9. P

    Simple code im derping on :P

    Your variable msg is not set, you need to adapt your code like this:Private Sub Command24_Click() Dim Msg As VbMsgBoxResult If IsNull(Me.Text1) Then Msg = MsgBox( "You have not filled all boxes." & vbCrLf & _ "Do you want to continue?", vbYesNo, "Edit Visit Report")...
  10. P

    Read Text field line by line

    If it is a onetime function: Function SplitMultilineTextField() Dim RS As DAO.Recordset Dim MultilineString As Variant Dim i As Integer Set RS = CurrentDb.OpenRecordset("Select * from YourtableName;") While Not RS.EOF MultilineString = Split(Nz(RS!YourFieldName...
  11. P

    Get Network Computer Name

    This Microsoft KBn article gives the sample code you need.
  12. P

    Code to find hidden tables?

    Untested: Function IsTableHidden(objTable As TableDef) As Boolean IsTableHidden = GetHiddenAttribute(acTable, objTable.Name) End Function
  13. P

    'iferror' equivalent in access

    There's a remark "unless used in a query" in the MS article. But no Replacevalue would generate a zero lenght string that wil generate a error when used in math functions.
  14. P

    'iferror' equivalent in access

    As you didn't provide a value to use if null the function wont work. Nz(FieldToTest, ReplaceValue) In your case: Nz([QUERY_A]![QTY1], 0)*Nz([QUERY_B]![QTY2], 0)
  15. P

    Concatenate Rows

    Because the SQL code in VBA is a string it won't evaluate your variable teamlead, you have to place the variable outside the string like: ((tRegion.TeamLead)= " & teamlead & ")) 'if teamlead is numeric ((tRegion.TeamLead)= '" & teamlead & "')) 'if teamlead is text
  16. P

    Import mutliple CSV files into one Access table

    I don't know if it's a copy paste problem but in the dir function there are spaces for the file filter so you get a empty list. The check for a empty list fails because there's no else, your code should look like: If intFile = 0 Then MsgBox "No files found" else 'cycle through the list of...
  17. P

    compiler syntax error

    The DoCmd output and send commands won't accept a where condition, a way arround this is to open the report in preview with a where condition active and then use the DoCmd export function like: stDocName = "ReportEmailNoticeofAssigned" stFilename ="C:\Documents and Settings\hortiz\My...
  18. P

    Filters and VBA

    You use "OR" in the build of your where critera and put an "AND" on the wrong place. Your code should be something like (untested). ' Check if there is a filter to return... If IsNull(varWhere) Then varWhere = "" Else ' strip off last "OR" in the filter ' If...
  19. P

    Add button to open my form on a blank record

    Why not open the form directly in append mode? DoCmd.OpenForm stDocName, , , stLinkCriteria,acFormAdd
  20. P

    Test that atleast One Checkbox is checked

    As Access handles True as -1 and False as 0 this should work (untested). If (Check_Add_New_Auditor_User + Check_Add_New_Error_Code + Check_Misc_Issue) = 0 Then MsgBox "Please Check a Reason for this Email" Else [/
Back
Top Bottom