Search results

  1. ErikSnoek

    [Access 2007] How do i create table in VBA

    Autonumber = counter Memo = memo e.g.: "CREATE TABLE exTable (ID counter, Name memo)" Creates a table with an autonumber field named "ID" and a memo field called "Name".
  2. ErikSnoek

    Calling Functions from command buttons

    Apparently you have two (or more) functions named "updatetblcontacts". Perhaps you pasted the function twice? Or once in several modules? Try a search (ctrl+F) in the VBA editor and search for "updatetblcontacts" in the "Current project" and make sure you have only one function named...
  3. ErikSnoek

    Potentially simple update question

    It's a bit hard to determine the problem after reading your description. Could you post the relevant part of the database so we can all take a look? Of course you do not have to include the real data ;)
  4. ErikSnoek

    Calling Functions from command buttons

    Perhaps you should try it directly from code instead of from the properties window (even though it would be weird if that'd work, but it's worth the try): Go to the On Click event and choose Event Procedure from the dropdown list. Click the ellipses (...) to enter the VBA editor. Now enter the...
  5. ErikSnoek

    Parse String

    It's a bit different from the code you posted, but it does the job: Sub GetIt() Dim strText As String Dim strPositions() As String Dim strFirst As String, strLast As String Dim strCriteria As String strText = "Tbl_Payment_YTD.[Rebate Period] Like " & Chr(34) & "*2007" &...
  6. ErikSnoek

    Calling Functions from command buttons

    Strange, it does work for me. I simply entered the text "=UpdatetblContacts()" in the textfield next to "On Click" under Events. Could you explain exactly what steps you take?
  7. ErikSnoek

    Calling Functions from command buttons

    Are you sure it's a function or is it a sub? Also did you place this function in a module or in a form? If in a form, is the function in the same form as the button that is supposed to call it?
  8. ErikSnoek

    Calling Functions from command buttons

    You can set the "On click" event of a command button (in the events tab of the properties window of a command button) to: =yourFunction() Whereas "yourFunction" is the name of your function.
  9. ErikSnoek

    Opening Notepad and pasting

    You could store the string in an invisible textbox.. but I guess the best way is to just paste all this in a new module: Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) _ As Long Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) _ As Long Declare Function...
  10. ErikSnoek

    Opening Notepad and pasting

    Here's one way to do it: Private Sub cmdTest_Click() If Not IsNull(txtTest.Value) Then 'checking if the txtTest (textbox) is empty txtTest.SetFocus txtTest.SelLength = Len(txtTest.Value) 'selecting the text in the textbox End If DoCmd.RunCommand acCmdCopy...
  11. ErikSnoek

    Logic question on an access application

    It's easy; One table has the main information like genre and title, the other table (child table) has information like the barcode and some yes/no field in which you store wether or not the dvd has been rented. The relationship between these two tables can be done by adding the unique identifier...
  12. ErikSnoek

    Opening Notepad and pasting

    I'm not sure how to do it through clipboard, but it's pretty easy to do it with a temporary file. Take a look here: Sub TextToNotepad() Dim strText As String, strFileName As String, objFileSys As Object, objTextFile As Object strText = "Throw this text to notepad!!" strFileName =...
  13. ErikSnoek

    Linked SQL Server tables become read-only

    Thanks for the reply. Yes, it has a primary key. However, when I link the tables using that whole Data Source wizard I get prompted to choose a unique identifier. So in that prompt I choose the field I set up as primary key on the SQL server. Maybe that is why I'm also able to write data then...
  14. ErikSnoek

    Linked SQL Server tables become read-only

    Hello everyone, I'm having a problem I can't seem to get around. I have an Access FE with a MSSQL 2005 BE and I'm trying to relink the tables everytime a user opens the database so they don't have to provide login details for the SQL server. I added the code shown below (found it on mcse.ms) in...
  15. ErikSnoek

    GoToRecord Issue

    Hello Aziz, You could use this piece of code: Dim rs As Object Set rs = Me.RecordsetClone rs.FindFirst = "[DistributorRef] = '" & strDistributorRef & "'" If Not rs.EOF Then Me.Bookmark = rs.Bookmark End If Hope this helps.
  16. ErikSnoek

    Looking for help with a multi select list box query

    Hello Nightspawn, You forgot to add the mandatory single quotes for strings in your SQL query. It should be WHERE [PCAREA]='AB', not WHERE [PCAREA]=AB. Change the following line: strTempItem = strTempItem & " [PCAREA]=" & Me.ActiveControl.ItemData(varItem) & " Or " to strTempItem =...
  17. ErikSnoek

    Time Calculations

    I'm not sure if this is what you wanted to know, but you can add hours to a time by using DateAdd("h", number of hours, your time)
  18. ErikSnoek

    Hiding prompts

    Use this piece of code: DoCmd.SetWarnings False Be sure to turn them back on again after executing your query. (with the same code, except True instead of False)
  19. ErikSnoek

    Form to enter report criteria

    You can create the OpenArgs string like this: stringtosend = Textbox1.Value & ";" & Textbox2.Value & ";" etc. and then use that string like this: DoCmd.OpenReport "name of your report", acPreview, , , , stringtosend
  20. ErikSnoek

    Form to enter report criteria

    Hi davea300, You could do this by using the OpenArgs variable of a report. Currently the code on your button is probably something like this: DoCmd.OpenReport "name of your report", acPreview The definition of the OpenReport sub is: OpenReport(ReportName, [View As AcView = acViewNormal]...
Back
Top Bottom