Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with QueryDef

Status
Not open for further replies.

Alabaster2100

IS-IT--Management
Apr 7, 2001
26
CA
The following is the vb code I'm using
Dim db As Database
Dim qd As QueryDef
Dim mySQL As QueryDef

Set QueryDef = cticket.CreateQueryDef("cticket", "UPDATE tbl_Ticket SET tbl_Ticket.TechID = cmb_SelectTech," & _
" tbl_Ticket.TicketClose = txt_CloseDate, tbl_Ticket.ResolveID = cmb_resolveType," & _
" tbl_Ticket.ResolveDetail = txt_ResolveDetail, tbl_Ticket.[Close] =chk_CloseTicket" & _
"WHERE tbl_Ticket.TicketID=cmb_SelectTicket.Value & ;")

DoCmd.SetWarnings (False)
DoCmd.OpenQuery (cticket)
DoCmd.SetWarnings (True)

' reset all values on form

When I try to execute the command I get an "Object required", can some one please tell me what object it wants and what I missed in my code.

TIA
HelpDesk@RWDI
 
what is cticket and how dod you initialize it? John Fill
1c.bmp


ivfmd@mail.md
 
what is cticket and how did you initialize it? John Fill
1c.bmp


ivfmd@mail.md
 
Dim db As Database
Dim qd As QueryDef
Dim mySQL As QueryDef

[red
Set db = Currentdb

MySql = ""UPDATE tbl_Ticket SET tbl_Ticket.TechID = cmb_SelectTech," & _
" tbl_Ticket.TicketClose = txt_CloseDate, tbl_Ticket.ResolveID = cmb_resolveType," & _
" tbl_Ticket.ResolveDetail = txt_ResolveDetail, tbl_Ticket.[Close] =chk_CloseTicket" & _
"WHERE tbl_Ticket.TicketID=cmb_SelectTicket.Value & ;")
Set qd = db.CreateQuerydef(Cticket, MySql)
[/red]

Instead of:

Set QueryDef = cticket.CreateQueryDef("cticket", "UPDATE tbl_Ticket SET tbl_Ticket.TechID = cmb_SelectTech," & _
" tbl_Ticket.TicketClose = txt_CloseDate, tbl_Ticket.ResolveID = cmb_resolveType," & _
" tbl_Ticket.ResolveDetail = txt_ResolveDetail, tbl_Ticket.[Close] =chk_CloseTicket" & _
"WHERE tbl_Ticket.TicketID=cmb_SelectTicket.Value & ;")

DoCmd.SetWarnings (False)
DoCmd.OpenQuery (cticket)
DoCmd.SetWarnings
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top