By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,508 Members | 1,856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,508 IT Pros & Developers. It's quick & easy.

Multiple Ifs and Null controls

P: n/a
jpr
Hello, I am reposting a question submitted some time ago to which I did
not get much help, hoping for additional advice.

My database has two tables. Table1 and Table2. Table2 is a copy of
Table1. Both tables have 50 fields. Data is imported into Table1 once a
week. Before importing data I run a delete query which removes all
data. Data imported adds records only to the following fields: FNAME,
LNAME, SSN. This means that I am left with 47 empty fields.

Users can see data in Table1 using Form1. They will see the FNAME,
LNAME and SSN. These fields are locked and cannot be edit or deleted.
All the other 47 fields are blank and user can add data to them.

Currently I am using two buttons to:
1) Close the form (with the code Me.Undo, Me. CLose)
2) Run and append query to Table2 and deleting all added data.

I would like to combine these two functions in one button which would:

If no data has been entered in the remaining 40 fields, than close the
form.
If data has been entered it should run the following procedure (Append
data into Table2):

Dim MyDb As DAO.Database, MyRs As DAO.Recordset
Dim strCode As String
Dim strFilter As String
Dim stDocName As String
Dim stLinkCriteria As String

Set MyDb = CurrentDb
Set MyRs = MyDb.OpenRecordset("Table1")
stDocName = "MyForm"

stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SetWarnings False
DoCmd.OpenQuery ("AppendtoTable2")
DoCmd.Close

The problem I am having is declaring all the 47 empty records. Any
suggestion or code? Thanks.

Jan 22 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think you mean 47 "fields", but look in Access help for the "Dirty" form
property (which fires whenever there's activity on the form). BTW, what's
the point of your data design? Frequent transfer/copy/deletion of records
suggests a bad structure.
-Ed

"jpr" <jp***@tin.itwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
Hello, I am reposting a question submitted some time ago to which I did
not get much help, hoping for additional advice.

My database has two tables. Table1 and Table2. Table2 is a copy of
Table1. Both tables have 50 fields. Data is imported into Table1 once a
week. Before importing data I run a delete query which removes all
data. Data imported adds records only to the following fields: FNAME,
LNAME, SSN. This means that I am left with 47 empty fields.

Users can see data in Table1 using Form1. They will see the FNAME,
LNAME and SSN. These fields are locked and cannot be edit or deleted.
All the other 47 fields are blank and user can add data to them.

Currently I am using two buttons to:
1) Close the form (with the code Me.Undo, Me. CLose)
2) Run and append query to Table2 and deleting all added data.

I would like to combine these two functions in one button which would:

If no data has been entered in the remaining 40 fields, than close the
form.
If data has been entered it should run the following procedure (Append
data into Table2):

Dim MyDb As DAO.Database, MyRs As DAO.Recordset
Dim strCode As String
Dim strFilter As String
Dim stDocName As String
Dim stLinkCriteria As String

Set MyDb = CurrentDb
Set MyRs = MyDb.OpenRecordset("Table1")
stDocName = "MyForm"

stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SetWarnings False
DoCmd.OpenQuery ("AppendtoTable2")
DoCmd.Close

The problem I am having is declaring all the 47 empty records. Any
suggestion or code? Thanks.

Jan 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.