pull records

M

Martin

Hello, I have a form called "frmTraining" that pulls data
from a query called "qryLosAngeles". Essentially the form
shows all users requesting training in the Los Angeles
area. Here's my dilemma; my form has a query as a record
source, The query only pulls data for users requesting
training at our Los Angeles site. I would like to create a
combo box that pulls data from all our other training site
locations (Fullerton, Anaheim, Pasadena. I have the query,
but I'm having problems on the AfterUpdate event, the form
will not populate with users from other locations other
than Los Angeles. I'm sure it has something to do with the
forms record source which pulls data specifically for our
Los Angeles site. Any suggestions on how I can accomplish
this I will greatly appreciate; Here's my code on the
AfterUpdate event of the combo box. It only works for Los
Angeles site request only.

Private Sub Combo214_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[AUTONUMBER] = " & Str(Me![Combo214])
Me.Bookmark = rs.Bookmark
End Sub
 
E

Eric Butts [MSFT]

Hi Martin,

Your question (" the form will not populate") along with your sample code
is a little confusing in what you are attempting to accomplish. I'll try
to answer it with guesses of what you are attempting

Form's RecordSource = "Select * From
Where [CityName] = Los Angles"

Combo box RowSource = "Select * From
Where [CityName] <> Los Angles"

How to make the above dynamic for example the city is now "Seattle"?

- Create a Pop Form called "Select-A-City"
- Create a textbox control on the Form named "CityEntered"
- Create a command button on the Form that opens your Form
- Change the above SELECT statements to
"Select * From
Where [CityName] =
Forms![Select-A-City]![CityEntered]"

"Select * From
Where [CityName] <>
Forms![Select-A-City]![CityEntered]"


I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
< http://www.microsoft.com/security/security_bulletins/ms03-026.asp > and/or
to visit Windows Update at < http://windowsupdate.microsoft.com/ > to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "Martin" <[email protected]>
| Sender: "Martin" <[email protected]>
| Subject: pull records
| Date: Mon, 9 Aug 2004 13:10:02 -0700
| Lines: 24
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcR+TNqhUjrl2UieSVSctejthkb5HQ==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.formscoding
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.formscoding:241590
| NNTP-Posting-Host: tk2msftngxa14.phx.gbl 10.40.1.166
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| Hello, I have a form called "frmTraining" that pulls data
| from a query called "qryLosAngeles". Essentially the form
| shows all users requesting training in the Los Angeles
| area. Here's my dilemma; my form has a query as a record
| source, The query only pulls data for users requesting
| training at our Los Angeles site. I would like to create a
| combo box that pulls data from all our other training site
| locations (Fullerton, Anaheim, Pasadena. I have the query,
| but I'm having problems on the AfterUpdate event, the form
| will not populate with users from other locations other
| than Los Angeles. I'm sure it has something to do with the
| forms record source which pulls data specifically for our
| Los Angeles site. Any suggestions on how I can accomplish
| this I will greatly appreciate; Here's my code on the
| AfterUpdate event of the combo box. It only works for Los
| Angeles site request only.
|
| Private Sub Combo214_AfterUpdate()
| Dim rs As Object
|
| Set rs = Me.Recordset.Clone
| rs.FindFirst "[AUTONUMBER] = " & Str(Me![Combo214])
| Me.Bookmark = rs.Bookmark
| End Sub
|
 
G

German Saer

If the field City is in the same form what you have to do is, in the event
Current of the form:

This is an example (of course)

Training.RowSource="SELECT Training, TrainingID FROM Trainings WHERE City
= '" & City & "' ORDER BY 1;"

....and, in the event AfterUpdate of the Field City:

Call Form_Current

This will change your "Training List" everytime you change your city or move
to another record.

I hope it helps.

Thanks,

German Saer
(e-mail address removed)
Orlando, FL 32809
 

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

Similar Threads

Search combo box 2
How to remove a filter 7
relationship design 3
After Update issue 1
128k record limit on forms???? 5
filtering records in form 1
recordsetclone question 27
Combo Box - List Box 1

Top