Search results

  1. D

    close button causes on exit events

    First off, I'm sure you just forgot to copy it, but there is no End Sub. Also, you don't have to use SetFocus at the end, when you cancel the update, it will keep the focus on the control. Doug
  2. D

    Dates

    Sure use this function... Public Function GetNRD(DOB As Date) As Date Dim TempDate As Date TempDate = DateAdd("yyyy", 65, DOB) If Day(DOB) <= 16 Then GetNRD = CDate(Month(DOB) & "/1/" & Year(TempDate)) Else GetNRD = CDate((Month(DOB) + 1) & "/1/" &...
  3. D

    Protection against adding duplicate data

    If I'm understanding you correctly, run a quick SQL check on the other table to see if it exists already... Dim MyDB as database dim MyRecs as recordset Dim MySQL as string MySQL = "SELECT * FROM [Table_Name] WHERE [Field1]='" & me!Value1 & "' AND [Field2]='" & me!Value2 & "'" Set MyDB =...
  4. D

    Check if table exists

    Alright well I just got it... Thanks anyway to everyone... In case other people would like it, here is the code.. I'm sure it could be quite useful.. Public Function CheckTable(TableName As String) Dim db As Database Dim tb As TableDef Dim bExists As Boolean Set db =...
  5. D

    Check if table exists

    I'm sure there's some way to do this through the system, but does anyone know how to check if a table exists in a database. I want to run a make table query if the table doesn't exist, and an append query if it does... What's the easiest way to go about checking the existence of the table?
  6. D

    Need help with a list and subform

    Well, depending on which one you used they do seperate things... I would suggest using the second one which is the SQL approach. What that code does is set the recordsource of the form to your beer table and only lists the data on the beer that you selected. It's similar to selected a...
  7. D

    Open a subform based on Name or ID

    Well, you should do a check to see which value isn't null and then change the recordsource of the subform accordingly, like so... if not isnull(me!Name) then me!SubForm_Name.Form.Recordsouce = "SELECT * FROM [Table_or_Query_Name] WHERE Name='" & me!Name) & "'" elseif not isnull(me!ID) then...
  8. D

    Spacing Question

    Just tested Mike's function with a textbox with spaces and carriage returns and it worked for me.. Are you sure you copied the code correctly? Are you sure you're passing the right string to the function? It's usually the little things that get me. Doug
  9. D

    Events - What is evaluated first.

    And of course the other solution being to throw some test lines in there. Create a form and put the control you want to find out the order. In each event you're looking for put a msgbox stating which event just fired, i.e. msgbox "Lost Focus" in the LostFocus event. Kind of a cheap way to do...
  10. D

    Creating new records using from entries

    Okay, your best bet is to create a subform on your main form with the recordsource of Client and link the CompanyName in the master and child links. This way, you can add the company name to both tables and add seperate data for each table. In case you didn't know, the Subform wizard is...
  11. D

    Need help with a list and subform

    Alright, well the link above isn't working, but I think I understand what you are trying to do. Put the following code in your command button's OnClick event when you want to see the item in the subform. Me!SubForm_Name.Form.Filter = "[BeerName]='" & me!ComboBoxName & "'"...
  12. D

    close button causes on exit events

    Okay, two things.. First you should put the code in the BeforeUpdate event of the textboxes. If the value is null, then just set Cancel=true and it will not allow the user to leave the control and will prevent the msgboxes popping up on closing the form. Secondly, you should use more...
  13. D

    Modules from Form to Form

    Alright, never mind.. I got it.. I just explicitly changed the properties of the controls from the original module... You know, it seems that things become a lot clearer when you write them down... Thanks for the help, it is greatly appreciated. Doug
  14. D

    Spacing Question

    Just an opinion here, not too sure, but Could this have anything to do with Carriage Returns... Getting rid of space won't get rid of Carriage Returns, right? Just a thought. Doug
  15. D

    Miscellaneous Characters

    Good suggestion... No nitpicking there.. Just a better answer... Thanks... Doug #2
  16. D

    Modules from Form to Form

    Okay, here is what I'm trying to do.... I have a form that has an ActiveX Calendar on it... The user has a choice of picking a single date or a date range... I open the calendar and let the user make their choice and variables get defined from what they select... Basically, the calendar has...
  17. D

    Date comparison..Need Help....

    In the AfterUpdate event of your textbox(ExpectedDate) put the following code... private sub ExpectedDate_AfterUpdate() if me!ExpectedDate = date then msgbox("Today is the Day!") end sub This one line will take care of this situation for you. Hope that helps. Doug
  18. D

    Modules from Form to Form

    For some reason, I can't get this working for me... Seems very simple, but yet I'm blank.. How can I call one forms subroutine from another form? Basically, I have a form open, then I open up another form and call a subroutine off of it, and then close the second form down.. I don't seem to...
  19. D

    Scroll Bars

    Do you have your tab control order set up correctly? You might have your last control on the right as the first control in your order, so each records sets focus to that one first. Just a thought. Hope that helps. Doug
  20. D

    Miscellaneous Characters

    Sure, no problem... Just add a quick subroutine in the BeforeUpdate event of the company name textbox... private sub companyname_Beforeupdate(cancel as integer) dim ctr as integer dim IsAsterisk as boolean IsAsterisk = false for ctr = 1 to len(me!CompanyName) if mid(me!CompanyName,ctr,1)...
Back
Top Bottom