Subform not receiving parent form values

brad78

Registered User.
Local time
Today, 10:26
Joined
Oct 10, 2008
Messages
32
Hi all,
Hope this isn't too "nub" of a question but I'm a little stuck.
I have a form which is used to add or view records. When viewing a record, I have a control button that, when clicked, copies the values in the text fields and dropdowns and inserts them into an update table. I have 2 problems with this...

1) one of the fields errors, giving me the following error, and I don't know what this means

Compile error: Method or data member not found

2) 2 of the values do not get passed into the update table. For the life of me, I cannot figure this out. My code from the command button is below and I'd appreciate any help I can get.
Thanks

Code:
Private Sub CopyToUpdates_Click()
'declare variables for holding data
Dim page_id As String
Dim page_file_name As String
Dim section_name As String
Dim contact_name As String
Dim content_type As String
Dim content_review_period As String
Dim page_last_updated As String
Dim expires As String
Dim page_status As String
Dim request_date
request_date = Date
 
Dim strSQLApp, strSQLDel As String
'load variables from data on form
page_id = Me.page_id
page_file_name = Me.page_file_name
section_name = Me.section_name
contact_name = Me.contact_name
content_type = Me.content_type
content_review_period = Me.content_review_period
page_last_updated = Me.page_last_updated
expires = Me.expires
page_status = Me.page_status
 
strSQLApp = "INSERT INTO update_html (page_id, page_file_name, section_name, contact_name, content_type, content_review_period, page_last_updated, request_date) VALUES ('" & page_id & "', '" & page_file_name & "','" & section_name & "', '" & contact_name & "', '" & content_type & "', '" & content_review_period & "', '" & page_last_updated & "', '" & request_date & "')"
 
DoCmd.RunSQL (strSQLApp)
 
End Sub
 
Hi all,
Hope this isn't too "nub" of a question but I'm a little stuck.
I have a form which is used to add or view records. When viewing a record, I have a control button that, when clicked, copies the values in the text fields and dropdowns and inserts them into an update table. I have 2 problems with this...

1) one of the fields errors, giving me the following error, and I don't know what this means

Compile error: Method or data member not found

2) 2 of the values do not get passed into the update table. For the life of me, I cannot figure this out. My code from the command button is below and I'd appreciate any help I can get.
Thanks

Code:
Private Sub CopyToUpdates_Click()
'declare variables for holding data
Dim page_id As String
Dim page_file_name As String
Dim section_name As String
Dim contact_name As String
Dim content_type As String
Dim content_review_period As String
Dim page_last_updated As String
Dim expires As String
Dim page_status As String
Dim request_date
request_date = Date
 
Dim strSQLApp, strSQLDel As String
'load variables from data on form
page_id = Me.page_id
page_file_name = Me.page_file_name
section_name = Me.section_name
contact_name = Me.contact_name
content_type = Me.content_type
content_review_period = Me.content_review_period
page_last_updated = Me.page_last_updated
expires = Me.expires
page_status = Me.page_status
 
strSQLApp = "INSERT INTO update_html (page_id, page_file_name, section_name, contact_name, content_type, content_review_period, page_last_updated, request_date) VALUES ('" & page_id & "', '" & page_file_name & "','" & section_name & "', '" & contact_name & "', '" & content_type & "', '" & content_review_period & "', '" & page_last_updated & "', '" & request_date & "')"
 
DoCmd.RunSQL (strSQLApp)
 
End Sub


I believe that your VALUES Statement may be incorrect. As it is currently formatted, the VALUES statement expects all of the columns to be strings (you have surrounded them by all by the ' character). Some of them appear to be Numbers and Dates.




If any of them are not strings, do the following:
  • Remove the surrounding ' characters
  • Change the fieldname reference to include cstr()
Ex: Assuming that page_is is a Number, then '" & page_id & "' would become " & cstr(page_id) & "
 
Last edited:
Thanks Rookie,
I'll give that a shot and see if it clears up the issue!
Brad
 

Users who are viewing this thread

Back
Top Bottom