Update several tables from a single user input

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am trying to create a query that updates several tables based on a single
user input. First, the user is going to import different sets of data into
different tables. Then, he/she is going to run a query that updates all the
blank DATE fields in all the tables with an entered date. This is what I have
for the single table query (for which I can thank another Access expert in
these forums):

UPDATE FourPanel SET FourPanel.[DATE] = [Enter Date]
WHERE (((FourPanel.DATE) Is Null));

Thanks in advance for your help,

Dan
 
Can be done using some code, like

Function UpdateTables()
Dim MyDate
MyDate = InputBox("Please select a date")
If IsDate(MyDate) Then
CurrentDb.Execute "UPDATE FourPanel SET [DATE] = #" & MyDate & "# WHERE
[DATE] Is Null", dbFailOnError
CurrentDb.Execute "UPDATE TableName2 SET [DATE] = #" & MyDate & "# WHERE
[DATE] Is Null", dbFailOnError
' the same code for the rest of the tables
End If

End Function

******************************
The other option is to create a form with a text box where the use can input
a date, and then in the query refer to that text box

UPDATE FourPanel SET FourPanel.[DATE] = Forms![FormName]![TextBoxName]
WHERE (((FourPanel.DATE) Is Null))

**************************8***
Note: It's not recomanded to use build in functions in Access as fields name
(Date, return the current date), will be OK as long that you define it in
square brackets
 

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

Back
Top