Run time error '424' Object required

G

gvaughn

I am having a problem with my code, all I am trying to do is take the value
enter in TBValueToEnter and place it in the TruckNumber of the database
dbo_TruckNumber. I have tried it this way:
Private Sub Command16_Click()
Tables![dbo_TruckNumber]![TruckNumber] = Me.TBValueToEnter
'Dim stDocName As String
'stDocName = "TruckNumber"
'DoCmd.OpenReport stDocName, acViewPreview
'DoCmd.PrintOut , , , , 1
'DoCmd.Close acReport, stDocName


and this way:
Dim stDocName As String
stDocName = "TruckNumber"
DoCmd.OpenReport stDocName, acViewPreview, ,
"[dbo_TruckNumber]![TruckNumber] =" & Me.TBValueToEnter
'DoCmd.PrintOut , , , , 1
'DoCmd.Close acReport, stDocName
'DoCmd.Close

the the second one my report opens, but the TBValueToEnter has not been put
into the TruckNumber field, any help would be nice this is driving me crazy.
Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top