Morning Everyone...
I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date Submitted defaults to 1/1/00 if the cboSubmittedBox field is "No". Otherwise it is selected from a calendar. The Date Entered field defaults to the current date. There are 3 sets of criteria that need to be checked for the update or append to take place.
Table Fields
Title, TitleID, Year Created, Submitted, Submitted To, Website, Type, Accepted, Date Submitted, Date Entered
All are based on one combo box with only two options.
1)
This option sets all the fields in the table to "Not Applicable" except the Title, TitleID, Year Created, Date Submitted and Date Entered fields.
2)
3)
What I need to do is have examples 2 and 3 query the table to the words "Not Applicable" in the any of the fields that contain that text, for example the website field. If the website field does not contain "Not Applicable" then the append query will run. If it does contain "Not Applicable" then the update query will run.
I cannot get the VB code to recognize the table "Created_Submit ted" and the field "Website". It would be coded as [Created_Submitt ed.Website] in an if statement such as If [Created_Submitt ed.Website] = "Not Applicable" Then...
Doing that doesn't work though. It just doesn't even run the append or update queries.
I have been fighting this off and on for a couple of weeks and am at my wits end. Any help you all could give would be greatly appreciated.
I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date Submitted defaults to 1/1/00 if the cboSubmittedBox field is "No". Otherwise it is selected from a calendar. The Date Entered field defaults to the current date. There are 3 sets of criteria that need to be checked for the update or append to take place.
Table Fields
Title, TitleID, Year Created, Submitted, Submitted To, Website, Type, Accepted, Date Submitted, Date Entered
All are based on one combo box with only two options.
1)
Code:
If Me![cboSubmittedBox] = "No" Then
Dim stAppend As String
stAppend = "Created_Submitted_Work"
DoCmd.OpenQuery stAppend, acNormal, acEdit
2)
Code:
If Me![cboSubmittedBox] = "Yes" Then
[B]HERE IS WHERE ADDITIONAL CODE NEED TO GO
BUT I CANNOT GET IT TO WORK. CODE WILL NOT
RECOGNIZE THE TABLE AND FIELDS I USE AND A
DLOOKUP ONLY GRABS ONE RECORD. THE
PROBLEM IS THE SAME FOR THE NEXT EXAMPLE.[/B]
Dim stAppend As String
stAppend = "Created_Submitted_Work"
DoCmd.OpenQuery stAppend, acNormal, acEdit
3)
Code:
If Me![cboSubmittedBox] = "Yes" Then
[B]HERE IS WHERE ADDITIONAL CODE NEED TO GO
BUT I CANNOT GET IT TO WORK. CODE WILL NOT
RECOGNIZE THE TABLE AND FIELDS I USE AND A
DLOOKUP ONLY GRABS ONE RECORD. THE
PROBLEM IS THE SAME FOR THE PREVIOUS EXAMPLE.[/B]
Dim stAppend As String
stAppend = "Created_Submitted_Update_Query"
DoCmd.OpenQuery stAppend, acNormal, acEdit
What I need to do is have examples 2 and 3 query the table to the words "Not Applicable" in the any of the fields that contain that text, for example the website field. If the website field does not contain "Not Applicable" then the append query will run. If it does contain "Not Applicable" then the update query will run.
I cannot get the VB code to recognize the table "Created_Submit ted" and the field "Website". It would be coded as [Created_Submitt ed.Website] in an if statement such as If [Created_Submitt ed.Website] = "Not Applicable" Then...
Doing that doesn't work though. It just doesn't even run the append or update queries.
I have been fighting this off and on for a couple of weeks and am at my wits end. Any help you all could give would be greatly appreciated.
Comment