Newbie form problem

S

Stephen

Greetings all

I have a table that is populated by a form called main. I want to place a
button to call up another form to continue to input data to the same record.
When i click the button to call the form, the record pointer seems to shift
to the beginning of the file...

any help would be appreciated

thanks
 
J

JeffW

Stephen,

you need to tell access which record to filter on.

dim stWhere as String
'for numeric datatype
stWhere = "[NameOfPrimaryKeyInUnderlyingTable]=" &
Me!NameOfPrimaryKeyControlOnForm
'or for text datatype
stWhere = "[NameOfPrimaryKeyInUnderlyingTable]='" &
Me!NameOfPrimaryKeyControlOnForm & "'"
DoCmd.OpenForm "YourForm",,,stWhere

Obviously you'll need to replace my generic names with yours.

HTH,
Jeff
 
S

Stephen

Thank You

This work perfectly

Steve
JeffW said:
Stephen,

you need to tell access which record to filter on.

dim stWhere as String
'for numeric datatype
stWhere = "[NameOfPrimaryKeyInUnderlyingTable]=" &
Me!NameOfPrimaryKeyControlOnForm
'or for text datatype
stWhere = "[NameOfPrimaryKeyInUnderlyingTable]='" &
Me!NameOfPrimaryKeyControlOnForm & "'"
DoCmd.OpenForm "YourForm",,,stWhere

Obviously you'll need to replace my generic names with yours.

HTH,
Jeff

Stephen said:
Greetings all

I have a table that is populated by a form called main. I want to place a
button to call up another form to continue to input data to the same record.
When i click the button to call the form, the record pointer seems to shift
to the beginning of the file...

any help would be appreciated

thanks
 

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