DoCmd.OpenQuery...How to capture query field info?

  • Thread starter Thread starter trekgoes2malaysia
  • Start date Start date
T

trekgoes2malaysia

In VBA, i recently tried to copy a value from a field in a query to a
variable I declared in an event procedure. I used the following code:

Dim stDocName as string
Dim getdate as integer

stDocName = "qdates"

DoCmd.OpenQuery stDocName
getdate= [dateid]
DoCmd.Close

My problem is that it doesn't work. Access does not recognise the
[dateid] field. This is different to when I use an DoCMd.OpenForm
statement where it would recognise the field I am referring to. SO my
question is ...how can I copy a field's data when running (opening) a
query in VBA as I have tried to do in my example?
 
Back
Top