Search results

  1. T

    If Then Do Nothing?

    Still learning VBA, so please bear with me. I have an If Then Statement which if the criteria is true, it executes, otherwise it should do nothing. When I execute the code (click the add record button), the following error results when the value is 2 or Null or blank, Run-time error...
  2. T

    Code Help: Checking to see if value exists in current database

    Hah! You were right, forgot to include "Study_ID" after the WHERE condition. sSQL = "SELECT Study_ID FROM dbo_Setup WHERE Study_ID = '" & Me.Add_Study_ID & "'" Well that was silly. Thanks!
  3. T

    Code Help: Checking to see if value exists in current database

    Alright, thanks. I'll keep at it!
  4. T

    Code Help: Checking to see if value exists in current database

    Hmm... would working in Access 2010 change any of the following, Dim db As Database Dim rs As DAO.Recordset Dim sSQL As String ???? I am using Access 2010 connected to a SQL 2005 server... so would it be? Dim cn As ADODB.Connection Set cn = CurrentProject.AccessConnection Dim rs As...
  5. T

    Code Help: Checking to see if value exists in current database

    The text field being checked is actually alphanumeric. I tried the code anyway, and the result was the same error. =(
  6. T

    Code Help: Checking to see if value exists in current database

    I am attempting to create a text field after update validation to check to see if a study id already exists. If it does, a warning message will appear informing the user that such a study already exist. Below is the code I have, however, upon execution, I receive the error, Run-time error...
  7. T

    Adding to a DateAdd

    Figured it out! sql3 = sql3 & ", " & Month(DateAdd("m", I - 1 + Me.Add_Study_Months_Elapsed, Me.Add_Dt_First_Subject_Enrolled)) & ","
  8. T

    Adding to a DateAdd

    I am attempting to add a specified amount of time (months elapsed) to an already existing value. However when the code executes, it returns values as if it is ignoring the "specified" amount of time which I have bolded below. Any ideas? sql3 = sql3 & ", " & Month(DateAdd("m", I - 1...
  9. T

    If Then Else If Compile Error Help

    Yes! I just need to fix the invalid use of null error I am getting. Thanks!
  10. T

    If Then Else If Compile Error Help

    If Me.Add_Recruitment_Started = "Yes" Then Monthstoadd = (Me.Add_Exp_Num_Mon_Enroll - Me.Add_Study_Months_Elapsed) Numtoenroll = (Me.Add_Tot_Target_Enroll - Me.Add_Study_Start_Enrolled) Else If IsNull(Me.Add_Recruitment_Started) Or Me.Add_Recruitment_Started = "" Then...
  11. T

    If Then Else If Compile Error Help

    Keep getting, "Compile error: Block If without End If" Any help for a VB newbie would be greatly appreciated! Thanks! If Me.Add_Recruitment_Started = "Yes" Then Monthstoadd = (Me.Add_Exp_Num_Mon_Enroll - Me.Add_Study_Months_Elapsed) Numtoenroll = (Me.Add_Tot_Target_Enroll -...
  12. T

    Multiselection Listbox Insert into SQL

    Alright, I've been at this for over a week trying to get the code pbaldy provided to work with SQL, unfortunately, I'm not getting it. Attached below is the code I currently have. I would like to add the function of a multi selection listbox which will add to a second table all selections in the...
  13. T

    Multiselection Listbox Insert into SQL

    Yes! Like that, but in SQL. How would I make this happen to record to a SQL server?
  14. T

    Multiselection Listbox Insert into SQL

    Hello everyone, I have a form which contains a single multiselection listbox. The listbox houses values of different facilities. I would like users to be able to select all applicable facilities pertaining to that record (could be 1 or more), and then click a button which would insert the...
  15. T

    Gradient background on Tab Control

    I have a form which has a tab control in it. By default the tab control has a white to sand gradient color background, from the tabs to the tab control background. I can't seem to figure out how to change the color. I have tried the properties, along with the shape fill. When I select shape fill...
  16. T

    Period(mdb) vs Underscore(accdb)

    Sorry, these tables are being pulled from a SQL server. In Access 2002, they are displayed with periods, and in Access 2010, they are displayed with an underscore.
  17. T

    Period(mdb) vs Underscore(accdb)

    I am in the process of migrating over a database from 2002 to 2010. One of the things I noticed different with 2010, is that Access will name tables using underscores e.g. dbo_asys_Employee. Whereas 2002 will use periods e.g. dbo.asys.Employee. What are the implications and issues that may...
  18. T

    Help with vbRetryCancel - defining vbCancel Range Check

    Hi Bob, Thanks for the suggestion! It semi worked! :D Here is the code I ended up using - Had to add another "Exit Sub" simply because when I selected "Retry" using your code, it continued to add the record with the month as null. If Me.NewMonth < 1 Or Me.NewMonth > 12 Then If...
  19. T

    Help with vbRetryCancel - defining vbCancel Range Check

    "Cancel = " is the area being highlighted during debugging. I have decided to attach the entire code which I am working with. For clarification, this is being setup as an ONCLICK add record event.
  20. T

    Help with vbRetryCancel - defining vbCancel Range Check

    I have tried this, but it comes back with a Compile error: Variable not defined
Back
Top Bottom