A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Expected Sub error



 
 
Thread Tools Display Modes
  #1  
Old June 9th, 2004, 06:15 PM
EdwardA
external usenet poster
 
Posts: n/a
Default Expected Sub error

While trying to update records using multiple append
queries, from one form and corresponding table, to another
form and corresponding table, I get the error Expected Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number as
a display match, before deleting the row from the data
entry table. This is used to provide visual verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub
  #2  
Old June 9th, 2004, 07:08 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default Expected Sub error

"EdwardA" wrote in message

While trying to update records using multiple append
queries, from one form and corresponding table, to another
form and corresponding table, I get the error Expected Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number as
a display match, before deleting the row from the data
entry table. This is used to provide visual verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub


You're missing an equals sign in this assignment statement:

sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


  #3  
Old June 9th, 2004, 07:25 PM
EdwardA
external usenet poster
 
Posts: n/a
Default Expected Sub error

Boy dont I feel like a Llama....

-----Original Message-----
"EdwardA" wrote in

message

While trying to update records using multiple append
queries, from one form and corresponding table, to

another
form and corresponding table, I get the error Expected

Sub
during the process of refreshing the form.

This is the code I have. I use the items serial number

as
a display match, before deleting the row from the data
entry table. This is used to provide visual

verification
that the item has indeed been updated.

Im sure its a simple enough solution, but I am not
grasping it.


Private Sub addinventory_Click()
On Error GoTo Err_addinventory_Click

Dim stDocName As String
Dim sdDocName As String
Dim seDocName As String
Dim sfDocName As String
Dim sgDocName As String
Dim sgLinkCriteria As String
Dim shDocName As String
Dim shLinkCriteria As String
Dim siDocName As String
Dim siLinkCriteria As String

RunCommand acCmdSelectAllRecords

stDocName = "STOCK_INC_WHSE27_Append"
DoCmd.OpenQuery stDocName, acNormal, acEdit

sdDocName = "STOCK_INC_REC_Append"
DoCmd.OpenQuery sdDocName, acNormal, acEdit

sgDocName = "STOCK_WHSE27"
sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"
DoCmd.OpenForm sgDocName, , , sgLinkCriteria

seDocName = "STOCK_INC_Delete"
DoCmd.OpenQuery seDocName, acNormal, acEdit

sfDocName = "STOCK_Incoming"
DoCmd.OpenForm sfDocName, acNormal, acEdit

Exit_addinventory_Click:
Exit Sub

Err_addinventory_Click:
MsgBox Err.Description
Resume Exit_addinventory_Click

End Sub


You're missing an equals sign in this assignment

statement:

sgLinkCriteria "[Serial Number]=" & "'" & Me![Serial
Number] & "'"


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.