Load data from combo box into pop-up form (1 Viewer)

Niniel

Registered User.
Local time
Today, 05:52
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
 

rborob

Registered User.
Local time
Today, 03:52
Joined
Jun 6, 2006
Messages
116
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
 

boblarson

Smeghead
Local time
Today, 03:52
Joined
Jan 12, 2001
Messages
32,059
Use the open form method to get the applicable record
Code:
DoCmd.OpenForm "YourFormName",acNormal,,[ComSupID]=" & Me.ComSupID
 

rborob

Registered User.
Local time
Today, 03:52
Joined
Jun 6, 2006
Messages
116
every time i post on here someone always says something better :p
 

boblarson

Smeghead
Local time
Today, 03:52
Joined
Jan 12, 2001
Messages
32,059
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.
 

Niniel

Registered User.
Local time
Today, 05:52
Joined
Sep 28, 2006
Messages
191
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?
 

boblarson

Smeghead
Local time
Today, 03:52
Joined
Jan 12, 2001
Messages
32,059
DoCmd.OpenForm "formname", acNormal, , YourWhereClause, , acDialog
 

Users who are viewing this thread

Top Bottom