Search results

  1. R. Hicks

    Getting extra copies of my report

    Check the recordset that the report is bound to. If each record is replicated 3 times then you have a problem in the query. HTH RDH
  2. R. Hicks

    Set focus on a subform

    If you are wanting to set focus to a control on the subform from the MainForm, then use this example: Me![YourSubFormControl].Form![ControlinSubForm].SetFocus Change "YourSubFormControl" to the name of the SubForm Control on the MainForm. Also change "ControlinSubForm" to the name of the...
  3. R. Hicks

    Snapshot Viewer

    I haven't used macros in years but here is code that will do what you ask: Private Sub EmailSnapshotFile(strReport As String, strRecipNames As String) On Error GoTo Err_EmailSnapshotFile DoCmd.Hourglass True If Len(strRecipNames) > 0 Then &nbsp DoCmd.SendObject acSendReport, strReport...
  4. R. Hicks

    Need Help With Some VB

    Rich is correct ... use the DMax() function to retrieve the highest number stored in the table for that specific field and add 1 to it to get the next number. To jwindon ......... When using an Autonumber datatype, if for any reason you don't complete a new record or the entry of a new record...
  5. R. Hicks

    Deleting a database

    I don't know why you are having a problem but the "Kill" statement will delete "any" file as long as it is not open at the time of execution. RDH [This message has been edited by R. Hicks (edited 02-14-2002).]
  6. R. Hicks

    clearing fields in a form

    You have a couple of problems here ........ First you have placed the line in the wrong place. The line will never execute the way you have it because the sub will exit and never get to the line of code. Try using this altered code. Notice where the line has been placed. Private Sub...
  7. R. Hicks

    Report Page Setting

    If you are using Access 2000 then you may have the original release. This problem existed in the original release. To fix the problem you need to install the Service Release patch from Microsoft as Rich suggested in his reply. Here is a link to the location where you can download the patch...
  8. R. Hicks

    Report Page Setting

    When you make the changes to the margins in the report ... you must save the change or they will revert back to what they were. RDH
  9. R. Hicks

    The OpenForm action was cancelled

    You need to add "Error Handling" to the Routine. Here is an example of what you need: Private Sub YourSubName_AfterUpdate() On Error GoTo Err_Handler ' ' Your Code Here ' Err_Handler:   If Err.Number = 2501 Then   &nbsp Resume Next   Else     MsgBox Err.Number & vbCrLf & Err.Description    ...
  10. R. Hicks

    Calculating age from 2 dates

    Being you are wanting the "age at the date of interview" ... not the "age based on todays date" .... try this: DateDiff("yyyy", [DOB], [IDate]) + ([IDate] < DateSerial(Year([IDate]), Month([DOB]), Day([DOB]))) "DOB" should be the "Date of Birth" information and "IDate" should be the "Interview...
  11. R. Hicks

    DoCmd.Close causing problem?

    Try "Compacting and Repairing" the database. This will sometime clear up weird and unexplained things that can sometimes happen in Access. HTH RDH
  12. R. Hicks

    Age Restricted Orders vs Dates Of Birth

    Use the following function to calculate the age from the date of birth: Public Function fGetAge(DOB As Variant) As Integer If Not IsDate(DOB) Then Exit Function fGetAge = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB), Day(DOB))) End Function HTH RDH [This message has...
  13. R. Hicks

    Date Function

    Don .... don't take my reply wrong. I was not "Criticizing" your method. I only meant that it was much more than needed. The "rule of thumb" in programming is "simpler is better". I have learned most of what I know about Access and VBA by answering questions on forums such as this (and I have...
  14. R. Hicks

    Date Function

    Hmmm .... I think that's a bit "overkill". Copy this Function to a new module: Public Function fGetAge(DOB As Variant) As Integer If Not IsDate(DOB) Then Exit Function fGetAge = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB), Day(DOB))) End Function Now in the unbound...
  15. R. Hicks

    This One's for Jack..little aberration

    This is not Jack ....... but how are you triggering the function (what event)? Being I don't know the details of what you are attempting to do .... could you explain? RDH
  16. R. Hicks

    Setting Report Margin Through Code

    Why are you having to set the margins manually each time? You should be able to set them in design view, then save the report and they should remain. Unless .......... If you happen to be using the original release of Office/Access 2000, there is a samll bug that kept the setting being...
  17. R. Hicks

    Print reports using Module

    I can't take credit for coming up with it. I learned this trick a few years ago on a forum much like this ..... I can't remember who posted it, or where I saw it, but it works. RDH
  18. R. Hicks

    Print reports using Module

    Great .... Glad you got it working. RDH
  19. R. Hicks

    Print reports using Module

    One way to do this is to create a table that consists of one field. Name the field "CopyName", set the Datatype as Text, set the "Allow Zero Length" property for this field to "Yes". Close and Save the new table and give it a name ... something like "tblCopies". Open this table, enter a space as...
  20. R. Hicks

    Debug window, Bugging Me!

    Check to see if to have code running in the background. You may have a form open that you are not working on that has something using the On Timer event. Code running in the background, it will cause weird things. HTH RDH
Back
Top Bottom