dbTalk Databases Forums  

Opening a form and goto specific reord.

comp.databases.ms-access comp.databases.ms-access


Discuss Opening a form and goto specific reord. in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vacuum Sealed
 
Posts: n/a

Default Opening a form and goto specific reord. - 10-08-2011 , 08:48 AM






Hi all

Can anyone help point me in the right syntax direction for the following
please...

Using a cmdbtn on frmmDirectory, I would like it to open frmmCustomers and
go straight to the record which is current in the unbound control in
frmmDirectory, I tried the following although it did not work.

Private Sub cmdGotoCustDetails_Click()
DoCmd.OpenForm "frmmCustomers", acNormal, , txtCustomerID =
Me.EditCustSelect, , acWindowNormal
End Sub

Appreciate the assist

TIA
Mick

Reply With Quote
  #2  
Old   
XPS350
 
Posts: n/a

Default Re: Opening a form and goto specific reord. - 10-08-2011 , 12:35 PM






If txtCustomerID is a text field the condition should look like:
DoCmd.OpenForm ... , "txtCustomerID = " & Me.EditCustSelect & "'", ...

Peter

http://access.xps350.com/

Reply With Quote
  #3  
Old   
Vacuum Sealed
 
Posts: n/a

Default Re: Opening a form and goto specific reord. - 10-08-2011 , 09:13 PM



Hi Peter

Thx for your assist.

txtCustomerID is a PK NumericField that is set to AutoNumber.

this way have something to do with why your suggestion failed as I got this
message:

Run-time error '3075':
Syntax error in string in query expression 'txtCustomerID=2"

So I thought maybe it had a missing operand like ( ' ) so I tried it this
way.

DoCmd.OpenForm "frmmCustomers", acNormal, , "'txtCustomerID = " &
Me.EditCustSelect & "'", , acWindowNormal

This opens the form "frmmCustomers" but only to the first record, not the
desired RecordNo which in the Run-time error message example above you can
clearly see it shows the value of the CustomerID

Thx again
Mick

Reply With Quote
  #4  
Old   
XPS350
 
Posts: n/a

Default Re: Opening a form and goto specific reord. - 10-09-2011 , 04:17 AM



Hello Mick,

With a numeric field it is:
...., "txtCustomerID = " & Me.EditCustSelect,...

Peter

http://access.xps350.com/

Reply With Quote
  #5  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Opening a form and goto specific reord. - 10-09-2011 , 06:42 AM



"Vacuum Sealed" <noodnutt (AT) gmail (DOT) com> wrote

Quote:
Hi Peter

Thx for your assist.

txtCustomerID is a PK NumericField that is set to AutoNumber.

this way have something to do with why your suggestion failed as I got
this
message:

Run-time error '3075':
Syntax error in string in query expression 'txtCustomerID=2"

So I thought maybe it had a missing operand like ( ' ) so I tried it this
way.

DoCmd.OpenForm "frmmCustomers", acNormal, , "'txtCustomerID = " &
Me.EditCustSelect & "'", , acWindowNormal

This opens the form "frmmCustomers" but only to the first record, not the
desired RecordNo which in the Run-time error message example above you can
clearly see it shows the value of the CustomerID

Thx again
Mick
Are you sure txtCustomerID is the name of the field in your table? I ask
because the txt prefix is usually given to a form's textbox control...

Reply With Quote
  #6  
Old   
Vacuum Sealed
 
Posts: n/a

Default Re: Opening a form and goto specific reord. - 10-09-2011 , 08:56 AM



Peter, Stuart

Thank you both.

Peter, sweet, that works nicely.

Stuart, the (txt) is what I use to differentiate each area of my DB's:

qry = Query
tbl = Table
dsp = Display
txt = Txt/ControlField
ubc = UnBoundControl
mod = Module
frmm = Forms Parent
frms = Sun Form
rpt = Report

This way If I have similar names in each area it makes it easier to
identify.

Thx again.
Mick

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.