Load data from combo box into pop-up form

Niniel

Registered User.
Local time
Today, 16:55
Joined
Sep 28, 2006
Messages
191
Hello,

Can't get this to work, hopefully someone can give me a hand here.

I have combo box on my form that loads some data into a subform. I may have to edit that data, so I put a command button next to the combo box that launches a form that I can use to edit the data with. So far so good.
My problem is that I would like the form to load the current record. All I seem to be able to do though is either start a blank form that creates a new record, or start the form with the first record in the table.
I tried to have the pop-up form read the Id of the record that's selected in the combo box, but I get a runtime error - can't assign a value to this object.

Private Sub Form_Load()
Me.ComSupID = Forms!frmRSC.ComSupID
 
if the sub form is bound you wont be able to assign any values to the fields in it,,,i dont think. Cant you use the OpenArgs to pass in the ID?

DoCmd.OpenForm stDocName, , , , , , ValueOFIDtopassIn
 
Use the open form method to get the applicable record
Code:
DoCmd.OpenForm "YourFormName",acNormal,,[ComSupID]=" & Me.ComSupID
 
every time i post on here someone always says something better :P
 
rborob said:
every time i post on here someone always says something better :P
Believe me, I got that alot too when I got started here, and still do at times.
 
Thank you!

I actually got it to work on my own because there's even a wizard for this. I must have... overlooked it at first. :D

[button code]:
stLinkCriteria = "[ComSupID]=" & Me![ComSupID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Where can I fit in the acDialog though so that I get a nice pop-up form?
 
DoCmd.OpenForm "formname", acNormal, , YourWhereClause, , acDialog
 

Users who are viewing this thread

Back
Top Bottom