G
Guest
I work at the Corporate office of a fast food chain. We have almost 1000
stores in 10 states - mostly in the South. We have many stores in the
hurricane zones. During Rita and Katrina we decided we needed a better way
to track how our stores are affected and what help we could provide. I've
designed a database to do this.
I have three main tables:
tblHurricane Info:
fldHurricaneYear
fldHurricaneName
tblUnitInfo:
fldUnit - the unit number assigned to the store
fldAddress
fldCity
fldState
fldZip
fldPhone
fldDO
fldMgr
tblUnitForm
fldAutoNumber
fldUnit
fldHurricaneName
fldProjectedClose
fldActualClose
fldProjectedOpen
fldActualOpen
fldDamage
fldWorkNeeded
I have a main form with subform set up. The form is based on a query run
with owner's permission. The query pulls together information from three
tables. The main form is autopopulated with the unit information based on
the unit selected by our contact center. The subform has the main data entry
fields noted in the tblUnitForm. What I want to be able to do is ask the
contact center employee for the unit number and the hurricane name. Based on
those responses, the main form will be populated and the subform is ready to
accept data entry. That's where I'm held up. I'm a beginning VBA programmer
- and reading Access 2003 Inside Out; Power Programming with Access 2003 and
Access 2003 VBA Reference. I've started a piece of code, but not sure how to
proceed from here. Here's the snippet:
dim intUnit as Integer
dim strName as String
dim strSQL as String
rst = qryFormDataEntry
intUnit = InputBox("Please enter the Unit Number", "Unit Number")
strName = InputBox("Please enter the Hurricane Name","Hurricane Name")
strSQL = "SELECT qryFormDataEntry.* FROM qryFormDataEntry " _
& "WHERE fldUnit = intUnit and fldHurricaneName = strName);
I may not have copied all the code correctly, but it did compile. I pasted
the code to the On Open event. I'm not sure if that is the place I need to
have it. My question is if I'm heading in the right direction with my very
limited VBA. I want the input from the user to populate the form. Any help
you might be able to offer will be very appreciated.
stores in 10 states - mostly in the South. We have many stores in the
hurricane zones. During Rita and Katrina we decided we needed a better way
to track how our stores are affected and what help we could provide. I've
designed a database to do this.
I have three main tables:
tblHurricane Info:
fldHurricaneYear
fldHurricaneName
tblUnitInfo:
fldUnit - the unit number assigned to the store
fldAddress
fldCity
fldState
fldZip
fldPhone
fldDO
fldMgr
tblUnitForm
fldAutoNumber
fldUnit
fldHurricaneName
fldProjectedClose
fldActualClose
fldProjectedOpen
fldActualOpen
fldDamage
fldWorkNeeded
I have a main form with subform set up. The form is based on a query run
with owner's permission. The query pulls together information from three
tables. The main form is autopopulated with the unit information based on
the unit selected by our contact center. The subform has the main data entry
fields noted in the tblUnitForm. What I want to be able to do is ask the
contact center employee for the unit number and the hurricane name. Based on
those responses, the main form will be populated and the subform is ready to
accept data entry. That's where I'm held up. I'm a beginning VBA programmer
- and reading Access 2003 Inside Out; Power Programming with Access 2003 and
Access 2003 VBA Reference. I've started a piece of code, but not sure how to
proceed from here. Here's the snippet:
dim intUnit as Integer
dim strName as String
dim strSQL as String
rst = qryFormDataEntry
intUnit = InputBox("Please enter the Unit Number", "Unit Number")
strName = InputBox("Please enter the Hurricane Name","Hurricane Name")
strSQL = "SELECT qryFormDataEntry.* FROM qryFormDataEntry " _
& "WHERE fldUnit = intUnit and fldHurricaneName = strName);
I may not have copied all the code correctly, but it did compile. I pasted
the code to the On Open event. I'm not sure if that is the place I need to
have it. My question is if I'm heading in the right direction with my very
limited VBA. I want the input from the user to populate the form. Any help
you might be able to offer will be very appreciated.