Populating fields

A

Amour

I am really new to VBA,
currently I have one form were I create meetings, than another one were the
individual is inputted(frmAttendance = qryAttendan = tblAttend) I am opening
a form(frmTravel = qryTravel = tblTravel) from a button with in
frmAttendance. FrmTravel has fields with in that when I close that from I
want it to populate some fields on the frmAttendance form. Also there is a
query that I want one of the fields to populate one field with in
frmAttendance and also write that field to tblAttendance. Because I want
tblAttendance to come up with the information from tblTravel it looks like I
am going to have to have a query.

Please help

Thank You!
 
J

John W. Vinson

I am really new to VBA,
currently I have one form were I create meetings, than another one were the
individual is inputted(frmAttendance = qryAttendan = tblAttend) I am opening
a form(frmTravel = qryTravel = tblTravel) from a button with in
frmAttendance. FrmTravel has fields with in that when I close that from I
want it to populate some fields on the frmAttendance form. Also there is a
query that I want one of the fields to populate one field with in
frmAttendance and also write that field to tblAttendance. Because I want
tblAttendance to come up with the information from tblTravel it looks like I
am going to have to have a query.

WHOA.

Stop right here.

It looks like you're trying to store data redundantly into tblAttend from
frmTravel.

Redundancy Is Bad. You should store information once, and once only. If you're
trying to store a foreign key value to relate two tables, use a Form with a
Subform.

How are your tables related? Do they have Primary Keys? Do you have
relationships defined? If you answer "no" or "what does that mean" to any of
these questions - your foundation is not yet poured, it's too early to start
framing in the house!

John W. Vinson [MVP]
 
A

Amour

First of all thank you for your response. I think what I am doing is: only
displaying information from tblTravel onto frmAttendance (not copying (not
data redundantly) to another table).

Here is my current SQL statement from qryattendan:

SELECT DISTINCTROW tblAttendan.MEET_NUM, tblAttendan.SSN,
tblAttendan.LAST_NAME, tblAttendan.FY, tblAttendan.TRVL_START,
tblAttendan.TRVL_END, tblAttendan.TRVL_CODE, tblAttendan.ATT_START,
tblAttendan.ATT_END, tblAttendan.POSITION, tblAttendan.DAYS,
tblAttendan.PAY_CLASS, tblAttendan.PAY_RATE, tblAttendan.AMT_PAID,
tblAttendan.PAYRL_DATE, tblAttendan.EST_TRVL, tblAttendan.ACT_TRVL,
tblAttendan.TO_APG, tblAttendan.FROM_APG, tblAttendan.INITIAL,
tblAttendan.UDATE, tblAttendan.[Estimated Airfare], tblAttendan.[Estimated
Per Diem], tblAttendan.LAST_NAME AS indexlastname, tblPersonnel.LAST_NAME AS
perslast, tblPersonnel.STATUS, tblPersonnel.CONSL_TYPE,
tblPersonnel.FIRST_NAME, tblPersonnel.APP_DATE, tblPersonnel.ROTAT_DATE,
tblPersonnel.ORIG_DATE, tblPersonnel.CNSL_DATE, tblMeeting.TITLE_NUM,
tblMeeting.FY, tblMeeting.TYPE, tblMeeting.TYPE_CODE, tblMeeting.TITLE_NUM,
tblMeeting.TITLE, tblPersonnel.PAY_RATE AS perspay, tblAttendan.COMMENTS,
NZ(TblTravel.DateProcessed) AS Expr1, NZ(TblTravel.Airfare) AS Expr2
FROM tblMeeting INNER JOIN ((tblPersonnel INNER JOIN tblTravel ON
tblPersonnel.SSN = tblTravel.SSN) INNER JOIN tblAttendan ON tblPersonnel.SSN
= tblAttendan.SSN) ON tblMeeting.MEET_NUM = tblAttendan.MEET_NUM
WHERE (((tblAttendan.MEET_NUM)=[forms]![frmMeetings]![meet_num]))
ORDER BY tblAttendan.LAST_NAME, tblAttendan.ATT_START,
tblPersonnel.FIRST_NAME;

And this is the part were I renamed:

NZ(TblTravel.DateProcessed) AS Expr1, NZ(TblTravel.Airfare) AS Expr2



In the frmAttendance I have a query that I want one of the fields to
populate one field with in frmAttendance and also write that field to
tblAttendance. Because I want
tblAttendance to come up with the information from tblTravel i. So I tried
adding on to the existing
query, but I get a message: " You can't go to the specified record"

Thank You for any help...
 
A

Amour

Thank you for your response...

Let me tell you what I want to do:

take a field from a tblTravel and display it on another form frmAttendance.
When I try to do this I get a message: "You can't go to the specified record"
How I am trying is I am adding the tblTravel to the current query. Not only
do I get that error but the whole database goes wrong (will not move between
record - like it use to) but when I remove this table then all is back to
norm from when I started. When I try entering =NZ[dateprocecced] into the
control source of that field frmAttendance I get #Name.

Next I want to take a counted field (already doing this in a query
qryTravel) and I want to display that value in the same form frmAttendance
and write that amount to the tblAttenance.

Please help

Thank You
 

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

Top