Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Need Help with Access 2007


  • Please log in to reply
3 replies to this topic

#1 petocities

petocities

  • Members
  • 102 posts
  • OFFLINE
  •  
  • Location:Santiago Chile
  • Local time:05:34 AM

Posted 15 January 2009 - 11:02 AM

Hello everyone. First off, i'm new to access, i've never used it before, but i'm helping a friend at the office.
We are using access 2007 on a pc running vista.
I've surfed the internet for a while trying to understand how to run a macro with a SQL query in it, but i just can't seem able to make it work. It keeps saying that i'm trying to use a function that office can't recognize.
The macro is a button that, when clicked, runs a certain code I made as a tester (which is probably the problem). The function code is:
[codebox]Function Revisar_Calendario()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdef As DAO.QueryDef
Dim consulta As String

Set db = CurrentDb
consulta = "SELECT Plazo FROM Actividades WHERE Plazo - Date < 7 Days"
Set rst = db.OpenRecordset("consulta plazos")
End Function

[/codebox]
The idea is to go through a table and gather the items which are coming to a certain date (and, if possible, send an email alerting the participants, which shouldn't prove very hard once i get the hand of the syntax)

Please, if someone could guide me a bit, it would be wonderful. I've searched for tutorials, but haven't had any luck with the ones i've found, so if anyone has a tip there, that's also greatly appreciated

~Pedro
---------------------
I guess that instead of "7 days" i should use "Date - 7" or something of the sort? I never understood very well the dating systems...

Edited by petocities, 15 January 2009 - 11:11 AM.

Posted Image

BC AdBot (Login to Remove)

 


#2 glnbnz

glnbnz

  • Members
  • 13 posts
  • OFFLINE
  •  
  • Local time:03:34 AM

Posted 15 January 2009 - 02:54 PM

Hello petocities,

You might want to start by going to this website: Martin Green's Access Tips

It has help me get through some rough spots with SQL in VB code. The areas marked Access and SQL Part 1 (thru) 4 should be of interest to you.

:thumbsup:
Note to self
<Insert something clever here>

#3 petocities

petocities
  • Topic Starter

  • Members
  • 102 posts
  • OFFLINE
  •  
  • Location:Santiago Chile
  • Local time:05:34 AM

Posted 15 January 2009 - 03:18 PM

Hello petocities,

You might want to start by going to this website: Martin Green's Access Tips

It has help me get through some rough spots with SQL in VB code. The areas marked Access and SQL Part 1 (thru) 4 should be of interest to you.

:thumbsup:

cheers mate ;D
Posted Image

#4 petocities

petocities
  • Topic Starter

  • Members
  • 102 posts
  • OFFLINE
  •  
  • Location:Santiago Chile
  • Local time:05:34 AM

Posted 19 January 2009 - 11:02 AM

Ok, i've been through the page posted before, but i still can't manage to handle access 2007 pretty well. It just keep giving me trouble with forms and subforms (Office access cant find the field referred to in your expression), and i don't know how to fix the problem. Also, i can't seem to be able to make the code in the macro work.
First it the problem with the forms. I have a form with subforms. The first one is supposed to show data from a company (name, etc). The subform that is giving me trouble (by saying that access can't find the field bla bla) is a subform that should show (and it does!) info from activities within the company.

the other problem i have is that i can't run the code i posted before (probably it has to be corrected) because access says that it has a function name that can't be found!
Function Revisar_Calendario()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdef As DAO.QueryDef
Dim consulta As String

Set db = CurrentDb
consulta = "SELECT Plazo FROM Actividades WHERE Plazo - int(Now()) < int(#12/30/2020#)"
Set rst = db.OpenRecordset("consulta plazos")
End Function

please, i need precise ways in how to fix this, because i seem to be skipping something that i haven't noticed through the tutorials :thumbsup:

Edited by petocities, 19 January 2009 - 11:07 AM.

Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users