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

User Interface Conceptual Questionn - on right track?

P: n/a
Hello all,

Thank you in advance for any guidance.

(The standard form/subform won't work because my users will mess up and not
enter a value for a category. I don't mean to speak ill of them... I'm just
being realistic.)

Can I make a form display 30 times in a row (and then stop), each time
creating a new record, but with each new instance of the form, increment the
value of one field +1?

and... after the first instance of the form, have data from some of the
fields carried forward through the rest of the other 29 instances? ( ? =
AfterUpdate: Me!txtTeacherID.Default = Me!txtTeacherID)

If there's a much more efficient way to do this, (I imagine there probably
is...) please send me off in the right direction.

I'm learning VBA, have a decent grasp on Access (I hope/think...)... My
users are even less sophisticated.

Here are the specifics:

frmObservation <bound to tblObservationReports>
txtTeacherID <many to one in tblPersonel>
txtStudentID <many to one in tblPersonel>
numScore
txtCategoryID <Many to one in tblCategory> (30 Categories for scores)

In the First instance of the Form, User chooses from list TeacherID and
StudentID and the First Category (txtCategoryID = 1) is Automatically
displayed and User enters a Number in numScore.

Form one saves record and closes, Form two opens...

On second Instance: TeacherID and StudentID are carried forward from
instance one and now txtCategoryID =2 is automatically displayed... User
enters numScore.

And So on to Instance 30... and then the final instance saves and closes.

As stated, I'm learning VBA as I go... so I'm wanting to know if this is
even a good concept. Many moons ago, I wrote simple work related stuff in
BASIC.

I'm thinking I need a looping counter of some sort, and nested within that
I'll have the code that increments the category... a loop within a loop,
right? Would this whole thing be attached to Form Instance One's "Open"
event? If so, would the procedure stop if the instance of Form 1 closed?
I'm thinking it would...?

Or is there a completly different and better way?

At any rate, thank you for reading my ramblings. I have several tomes of
reference, What I'm hoping for is some conceptual guidance to direct my
reading.

Thanks,
Mike D.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.737 / Virus Database: 491 - Release Date: 8/11/2004

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I would try and stick to the sub-form idea. You can most certainly put in
all kinds of verification code. And, if you wish you can also put in a field
that will display the "number" of the entry.

You can put the following code in the sub form:

Function Rpos(vId As Variant) As Long

Rpos = 0
If IsNull(vId) = False Then
Me.RecordsetClone.FindFirst "id = " & vId
If Me.RecordsetClone.NoMatch = False Then
Rpos = Me.RecordsetClone.AbsolutePosition + 1
End If
End If

End Function

Then, you can put a un-bound text box in the continoues form,and for the
datasouce of this box you put:

=(rpos([id]))

The above assumes you have a key field called id. It also assumes dao.

The above will thus give you that "counter" field. However, as mentioned, I
think you should try and use a sub-form, as it will be the best way here.
Here is some screen shots of continues forms...and they might very well give
you some ideas:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #2

P: n/a
Thanks so much for the reply... I just want to ask a few questions to make
sure I'm clear...

1) The code below is declaring a function that I can call that will cycle
through the "id" values? So this code goes in the general declarations
section of the form? Sorry... Still learning...

You can put the following code in the sub form:

Function Rpos(vId As Variant) As Long

Rpos = 0
If IsNull(vId) = False Then
Me.RecordsetClone.FindFirst "id = " & vId
If Me.RecordsetClone.NoMatch = False Then
Rpos = Me.RecordsetClone.AbsolutePosition + 1
End If
End If

End Function
2) This text box (below) is calling the function to display the cycled
value of "ID" in what ever form I put it in?

Then, you can put a un-bound text box in the continoues form,and for the
datasouce of this box you put:

=(rpos([id]))

The above assumes you have a key field called id. It also assumes dao.


3) I was trying to stick with ADO, but if I include the DAO libraries it
should be ok, right?

My big problem is I'm trying to stay normalized but the consumer of the data
considers the 30 seperate records to be one "record." (I can get the data
out in reports using SQL well enough, I'm having trouble getting the data
into the table via the user) So it's imperative that my user enter a value
(numScore) for each category (txtCategoryID (30 in number)) each time they
use the application, even if the value is null. I'd also like to present
them with just the 30 categories at a sitting if possible. This would
outwardly mirror the paper form that they've been using to record the data.
A continuous form would appear foreign to them.

In my mind, I see 30 input boxes popping up creating the thirty records.
Each with a seperate prompt and category, carrying forward the TeacherID,
StudentID and Date from the first input box. But I don't know if that's
reasonable or even possible with Access /VBA.

Thanks again... I'm trying to learn...
Mike D.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.737 / Virus Database: 491 - Release Date: 8/11/2004

Nov 13 '05 #3

P: n/a
Yes, put the code example in the forms module code.

In fact, you *might* have to make the code public, but still place it in the
forms module.

Public Function Rpos(vId As Variant) As Long
1) The code below is declaring a function that I can call that will cycle
through the "id" values? So this code goes in the general declarations
section of the form? Sorry... Still learning...


Yes, just put the code in the form's module. Then, place a text box on the
continues form, and make the data source:

=(rpos([id]))
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.